openhab / openhab-addons

Add-ons for openHAB
https://www.openhab.org/
Eclipse Public License 2.0
1.87k stars 3.58k forks source link

[freebox] Switch to Jetty for HTTP and Gson for Json #4012

Closed lolodomo closed 5 years ago

lolodomo commented 6 years ago

I have plans for switching to Jetty for HTTP requests and to Gson for Json parsing. That would imply stopping using the library freebosos-java. The idea is to be more compliant with the openHAB recommendations and to be able to define trusted certificates ( https://github.com/eclipse/smarthome/issues/6196 ).

lolodomo commented 6 years ago

Freebox provides a WebSocket API. I could rather investigate this way of communicating.

lolodomo commented 6 years ago

@kaikreuzer : can you please advice what current binding is the best example using WebSocket API ? I found the bosesoundtouch binding in ESH but there are apparently few others bindings in OH2.

cweitkamp commented 6 years ago

@lolodomo Kodi uses WebSocket. You should have a look a this new ESH feature https://github.com/eclipse/smarthome/pull/6258. That could be interesting for you. But I am afraid we do not have an integration example for it yet :wink:.

kaikreuzer commented 6 years ago

Yes, https://github.com/eclipse/smarthome/pull/6258 would be my suggestion as well - the way to use it is identical to the Jetty http client, i.e. get it injected in the handler factory and then pass it on to your handler.

Wrt gson, you might even want to wait for https://github.com/eclipse/smarthome/pull/5856 as this makes the implementation independent of gson as a library.

So looks as if you'll be at the bleeding edge here ;-)

lolodomo commented 5 years ago

Regarding the WebSocket API, it is finally available only for one particular feature, the file upload on the freebox server, a feature that is not used by the binding. For everything else, the HTTP¨API must be used.

lolodomo commented 5 years ago

Done.