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.
After connecting, you could interact with the device and agent through the existing api, like so:
device.on ‘someEvent’, (someData) ->
# do something with someData
# 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.
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.