Closed rufferson closed 8 years ago
RockWork already supports Websockets, but I've had to ifdef it out because the QtWebsockets API was introduced in a newer version of Qt than Sailfish currently supports. Someone in the thread suggested an alternative implementation, but it might block this.
According to this https://lists.sailfishos.org/pipermail/devel/2015-April/005917.html QtWebSockets could be built for 5.2 - but i think dragging statically linked library is a bit too much.
That would be cleaner than having to overlay some alternative implementation though. I will have a go of this because it's really limiting our future interactions with pebble.com too.
Coderus already built it:
Interesting to note - mozilla implements certain websocket interface [SB2 sdk-install SailfishOS-armv7hl] root@SailfishSDK ~ # strings /usr/lib/xulrunner-qt5-38.0.5/libxul.so|grep nsIWebSocket 19nsIWebSocketChannel ]zs20nsIWebSocketListener [SB2 sdk-install SailfishOS-armv7hl] root@SailfishSDK ~ # strings /usr/lib/xulrunner-qt5-38.0.5/libxul.so|grep WebSocket:: PWebSocket::Msg_Close PWebSocket::Msg_SendMsg PWebSocket::Msg_SendBinaryMsg PWebSocket::Msg_DeleteSelf PWebSocket::Msg_OnStart PWebSocket::Msg_OnStop PWebSocket::Msg_OnMessageAvailable PWebSocket::Msg_OnBinaryMessageAvailable PWebSocket::Msg_OnAcknowledge PWebSocket::Msg_OnServerClose PWebSocket::Msg_delete PWebSocket::Msg_AsyncOpen PWebSocket::Msg_SendBinaryStream WebSocket::mMutex [SB2 sdk-install SailfishOS-armv7hl] root@SailfishSDK ~ #
not sure how practically it's usable yet, and anyway dragging mozilla context and parent/child threads to the daemon will be silly. however it may still be usable for devel connection - eg. to bridge/proxy it through the client's embedlite.
or actually no, listener is not serverside glue, merely async helper for the client-side socket. a bit misleading.
should be fixed by #36
The protocol implementation is in libpebble2 - https://github.com/pebble/libpebble2/blob/master/libpebble2/communication/__init__.py : PebbleConnection By default pebble-tool communicates with the phone on port 9000: def _connect_phone(self, phone): parts = phone.split(':') ip = parts[0] if len(parts) == 2: port = int(parts[1]) else: port = 9000 connection = PebbleConnection(WebsocketTransport("ws://{}:{}/".format(ip, port)), **self._get_debug_args()) connection.connect() connection.run_async() return connection