Robot Not a Dev? Pre-order Now
Not a Dev?

Documenation error?



@Donna I think there might be a documentation error in the Websockets introduction. I started at the very beginning ( during my onboarding. Successfully did so and got down to the part where it talks about “Writing Skills”. In that section there’s a part about websockets and an example for ToFs.

In the sample code, the first section describes how to construct the “subscribe” message. At the bottom of that sample snippet, there are two JSON objects created one called “subMsg” and one called “unsubMsg”.

Further down in the description, it talks about opening, subscribing, unsubscribing and closing websockets for the ToFs. There’s a line where it says “socket.send(message)” – but “message” seems to be an undefined variable. Further down in the code, where it describes unsubscribing, it passes “unsubMsg” (the JSON object from above?). That leads me to wonder whether the variable “message” should really be the “subMsg” JSON object from the snippet above. True? Or am I missing something about where the variable “message” is defined?


Hey Tim and @Donna I found the corresponding code from the Assets file from GitHub - MistyCommunity/Hackathon: The New York Developer Week Hackathon challenge. Includes instructions and sample code to get started., in the lightSocket.js file which enables subscribing/unsubscribing websockets, the line says
var message = JSON.stringify(msg);
And I have tested this code with Chris weeks ago and it worked then. Do you think it’s correct and we should update the docs?


@Donna will have to decide what’s correct; I have to ability to do so. All I can do is point out the docs say subMsg rather than message.


Thanks, very much for the heads up, @tenwall and @lucyz! I’ll review the code and docs today and get this sorted!


Thanks again to you both! I had to refresh my memory, but here’s what I see is going on.

  1. First, just an FYI for anyone else who sees this thread, the sample code discussed and linked to in the article is tofApp.js. It’s here: MistyI/Sample Code/Time of Flight at master · MistyCommunity/MistyI · GitHub

(You are right, @lucyz that lightSocket.js is a quite similar working sample – it’s just not used in this article.)

  1. @tenwall you are absolutely correct that message should be subMsg. Looking at the GitHub checkins, I can see that Heather actually fixed that in her code back in July, so I will update the docs today to include that fix. Thanks again!


The corrected content is live here: Misty Docs | Remote Command Architecture