thalmiclabs / myo.js

Myo javascript bindings
Apache License 2.0
198 stars 63 forks source link

Myo.js had an error with the socket #23

Open bendiksolheim opened 8 years ago

bendiksolheim commented 8 years ago

Hello

I struggled quite a bit with connecting to Myo from node.js. No matter what, I got the error message Myo.js had an error with the socket. Myo Connect might not be running. If it is, double check the API version.Myo.js had an error with the socket. Myo Connect might not be running. If it is, double check the API version..

After a while, I tried removing the "app id" in my.connect("my-app-id"), and suddenly it worked. Turns out it crashes if you have less than 3 dot-separated words in your app id (i.e. "my.app.id"). This might be common sense, I don't know, but I can't see any mention of it in the documentation. Also, the error message is not very helpful. I debugged it a bit (add console.log(arguments) between line 20 and 21 in myo.js), and it seems the websocket started by Myo Connect returns 400 if you have less than 3 dot-separated words in your app id.

vshivam commented 8 years ago

I have been using the Android SDK for Myo. The corresponding init method in the Android SDK says,

applicationIdentifier : must follow a reverse domain name format (ex. com.domainname.appname). Application identifiers can be formed from the set of alphanumeric ASCII characters (a-z, A-Z, 0-9). The hyphen (-) and underscore (_) characters are permitted if they are not adjacent to a period (.) character (i.e. not at the start or end of each segment), but are not permitted in the top-level domain. Application identifiers must have three or more segments. For example, if a company's domain is example.com and the application is named hello-world, one could use "com.example.hello-world" as a valid application identifier. Application identifiers must not be longer than 255 characters. applicationIdentifier can be an empty string.

https://developer.thalmic.com/docs/api_reference/android/classcom_1_1thalmic_1_1myo_1_1_hub.html#a91352ca197594c1cd447755d83d0b4e1