Feature request: Electric Imp realtime library

I’ve seen the request for a websocket interface crop up several times now, and I know it’s my most-wanted feature on the imp. I wanted to throw out a quick proposal that I think would be extremely useful, and maybe get some feedback from others or the EI team.

The basic basic functionality is this: the electric imp agent would be able to accept websocket connection requests from an electric imp javascript client library. This client library would initiate these requests with the id of the device or the agent, so the end user could connect simply by calling (pardon my coffeescript):

imp.connect ‘imp-or-agent-id’

After connecting, you could interact with the device and agent through the existing api, like so:

device.on ‘someEvent’, (someData) ->
# do something with someData

device.onConnect, ->
# do something, now that we’re connected

device.send ‘someEvent’, someData

agent.on ‘someEvent’, (someData) ->
# the agent did something, here’s some data

agent.send ‘someEvent’, someData

And so on. Basically, every time anything gets passed between the device and the agent, pass it also to any connected websocket clients. You could build this all on top of socket.io/similar, and although I don’t know your tech stack on the backend, this doesn’t seem too daunting. Plus, every developer that uses your websocket interface is one less that is polling, or trying to stream data via HTTP POSTs.

Why javascript? Well, in one shot, you get the browser and the server. It’s great to have a frontend library, because hacking something together in the browser is extremely quick. As a bonus, you don’t have any issues with cross-domain requests - things will work out of the box in an html file on your desktop (I’ve seem some newer web developers having trouble communicating with agents). And then there’s the backend - node was built for realtime steez, and it would be awesome to extend that to the hardware level.

I’m definitely excited to see some websocket integration on the EI platform. I think it would open up some cool new possibilities - let me know if I can help in any way.

Disclaimer - I built valet (github.com/onemightyroar/valet), so I’m kind of enthusiastic about sockets/node.

Hi, Any ETA update on WebSocket? ironically the final product would less likely to need high volume or fast data transfer, but for quick demonstration or early prototype the above realtime show off is needed.