buttplug
buttplug copied to clipboard
Keep alive for websocket server
Currently the websocket server is getting shutdown if 0 clients are connected (after once there was a connection). For my project i want to have a deamon running the websocket server and another program only connecting every now and then to send some commands. But as the websocket server is shutting down after the client disconnects, this is not possible.
Am i overseeing something or is this usecase not intended?
If you need a daemon running the websocket server, why not just run https://github.com/intiface/intiface-engine? This is the CLI version of Buttplug basically, and it keeps the websocket alive by default for you.
(BTW, Intiface Central is just the GUI on top of Intiface Engine. Central is basically just an command line argument creator heh.)
I tried out intiface too, but the same thing happens. Only the first connection works properly, afterwards the mpsc channel is closed.
So here some log from intiface, but it's the same with using buttplug directly as a library:
2022-12-14T15:28:49.354663Z INFO intiface_engine::engine: Starting server
2022-12-14T15:28:51.465316Z INFO buttplug::core::connector::transport::websocket::websocket_server: Websocket: Got connection
2022-12-14T15:28:51.472335Z INFO buttplug::core::connector::transport::websocket::websocket_server: Starting websocket server connection event loop.
2022-12-14T15:28:51.472346Z INFO buttplug::server::remote_server: Starting remote server loop
2022-12-14T15:28:51.518371Z INFO buttplug::core::message::serializer::json_serializer: Setting JSON Wrapper message version to Version3
2022-12-14T15:28:51.518658Z INFO buttplug::server: Performing server handshake check with client test client at message version Version3.
[Connecting for the first time]
2022-12-14T15:28:51.519020Z INFO intiface_engine::frontend: Client connected: test client
2022-12-14T15:28:51.526179Z INFO buttplug::server::device::server_device_manager_event_loop: No scan currently in progress, starting new scan.
2022-12-14T15:28:53.424964Z WARN buttplug::core::connector::transport::websocket::websocket_server: Error from websocket server, assuming disconnection: Protocol(ResetWithoutClosingHandshake)
2022-12-14T15:28:53.425142Z INFO buttplug::core::connector::remote_connector: Connector closing connection Websocket server closed
[From now on now connection is possible anymore]
EDIT: Weiiird, i'm now using the master branch of buttplug-rs and the issue seems to be gone?
Closing as it's now working. Thanks :)