Add support for WebSocket #366
Replies: 9 comments 19 replies
-
I think that is a great idea. The library https://libwebsockets.org seems to be the way to go. They also support libuv, the event loop used by ThingsDB. |
Beta Was this translation helpful? Give feedback.
-
@stefanak-michal , in branch https://github.com/thingsdb/ThingsDB/tree/lws I'm testing with WebSockets. However, it is testable. I've added two simple files for testing:
(My browser didn't like self signed certificates so I've added the Python file for TLS/SSL testing) |
Beta Was this translation helpful? Give feedback.
-
I have made Dockerfile to have ThingsDB instance with websocket support. It is available here: https://github.com/stefanak-michal/thingsdb.js/blob/dev/ci/thingsdb.Dockerfile I just have one question. When I tried |
Beta Was this translation helpful? Give feedback.
-
@stefanak-michal , I've switched the build system to CMake (https://cmake.org/) in the The Dockerfiles have been updated, for a manual build you can run If you have experience with CMake, I'd appreciate any feedback on how the build could be further improved. |
Beta Was this translation helpful? Give feedback.
-
The Python client can now connect using both Socket and the new WebSockets. This is also convenient for testing. await client.connect('ws://localhost:9270') # Or wss:// when Secure WebSockets is enabled |
Beta Was this translation helpful? Give feedback.
-
@stefanak-michal , I think we're almost ready for making a ThingsDB release with WebSocket support (v1.6.0). I've just fixed some minor issues related to Cmake on MacOS and this too seems to work fine now. |
Beta Was this translation helpful? Give feedback.
-
Okay. I think I'm good. https://github.com/stefanak-michal/thingsdb.js |
Beta Was this translation helpful? Give feedback.
-
I've added the JavaScript connector to the ThingsDB documentation: https://docs.thingsdb.io/v1/connect/javascript |
Beta Was this translation helpful? Give feedback.
-
WebSockets is implemented, closing the conversation. Thanks @stefanak-michal ! |
Beta Was this translation helpful? Give feedback.
-
After our calls I was thinking about building javascript library and I've finally found some time this week. My goal was to make it work in browser and also in backend (nodejs). But I hit a roadblock because TCP socket connection is not possible from browser javascript. They only way is to use WebSocket. Would you consider adding support for WebSocket into ThingsDB?
I know HTTP API is available but it doesn't work both ways so listening is not possible with it.
Beta Was this translation helpful? Give feedback.
All reactions