WebSockets in SmartDevices

(Dav Glass) #1

I know a SmartDevice can use HTTP, any chance they can connect via WebSockets?

(John S) #2

Well, groovy supports websockets. So… maybe?

(Alex) #3

No, no chance. Been there, done that.

(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #4

On the LAN? Cloud? Or both?

I haven’t a clue, but love the question.
I know (?) some non-trivial part of the LAN networking protocols (TCP, HTTP, device discovery?) is implemented in firmware on the Hub, so no amount of Groovy can overcome limitations in the hub stack. I wish we had detailed specs, right?

For the same or similar reason, there’s no UDP support. It can’t just pass all the packets to the Smart Cloud and there’s more than just “wrapping” going on…

Hub V2 is Linux based, so it may be easier for ST to accommodate more modules and protocols.

(Dav Glass) #5

Cloud only, it’s to connect to another web service that only does WebSockets.

(ActionTiles.com co-founder Terry @ActionTiles; GitHub: @cosmicpuppy) #6

In that case, it must depend on what is allowed in the Groovy “Sandbox” the Community Developers are allowed to play-in. On the Developer Conference Calls, etc., we’ve asked for a list of all the permitted library modules that we can load, but not been given an answer.


(Jeff Beck) #7

What API is it?

Also depending on how the api is set up you may run into the execution timeout issues if the API is intended to be a streaming thing.

(Patrick Stuart [@pstuart]) #8

It can be done, just major limitations. Might need to route the requests through a smartapp and only via IP address via local hubaction, but it can be done. Even UDP.

(Dav Glass) #9

I was able to hook into the Water Furnace API, which is WebSocket only, and mess with it.

It’s not device friendly since it’s a constant connection. To get around this I’ve setup a local app that “proxies” the data so it doesn’t beat up ST. Basically it takes a simple Get request, does a few small WebSocket calls & returns the data back.

Kind of an HTTP -> WS -> HTTP proxy. Just to play around with it.

(Rafael Borja) #10

Could you share the code ?