I know a SmartDevice can use HTTP, any chance they can connect via WebSockets?
Well, groovy supports websockets. So… maybe?
No, no chance. Been there, done that.
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.
Cloud only, it’s to connect to another web service that only does WebSockets.
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.
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.
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.
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.
Could you share the code ?