You are reading a single comment by @hansamann and its replies. Click here to read the full conversation.
  • First let me say the outlook to get websocket support on the espruino is excellent. Also I recently got in touch with SSE - Server Sent Events, which looks like a cool and easy implementation if you just need to send events from the server.

    http://en.wikipedia.org/wiki/Server-sent­_events

    Essentially the client, e.g. espruino connects to a socket and the server keeps the connection open. A new message is simply seperated via \n and carriage return (or so, details in the spec, but really easy).

    SSE or WebSockets - I see the espruino being the initiating "client" in these scenarios. It just seems to be the easier option to connect out than trying to expose the local IP/server to the outside. Is this common thinking or is there a better option that I am missing?

    Also, unfortunately WS/SSE sometimes fail - so an onError handler with the option to recreate the connection could make the connection really stable. Can this be done? I know there is no exception handling, is this required for a onError callback for a websocket? Or is this handled in your integration code and thus no JS Exception handling would be required?

About

Avatar for hansamann @hansamann started