#websocket #tokio

basws-server

A simple async WebSocket client/server framework

13 releases

0.1.4 Feb 8, 2021
0.1.3 Feb 5, 2021
0.1.1 Jan 30, 2021
0.1.0-dev-8 Oct 20, 2020
0.1.0-dev-6 Sep 30, 2020

#54 in WebSocket

Download history 28/week @ 2022-03-10 54/week @ 2022-03-17 2/week @ 2022-03-24 3/week @ 2022-03-31 4/week @ 2022-04-07 3/week @ 2022-04-14 3/week @ 2022-04-21 41/week @ 2022-04-28 81/week @ 2022-05-05 211/week @ 2022-05-12 55/week @ 2022-05-19 67/week @ 2022-05-26 120/week @ 2022-06-02 3/week @ 2022-06-09 5/week @ 2022-06-16 3/week @ 2022-06-23

157 downloads per month
Used in basws

MIT license

52KB
1.5K SLoC

basws-server

crate version

basws-server is a simple WebSocket framework. For more information, see the basws README.

To set up your own protocol server:

  • Implement the ServerLogic trait
  • Create a Server passing in your ServerLogic implementor
  • In your warp filters, call server.incoming_connection with the websocket during on_upgrade. Make sure to move into closures and clone() as needed. The Server is a reference-counted type, so cloning is cheap.
  • You can use server.send_to_installation_id, server.send_to_account_id, and server.broadcast to communicate out-of-band with clients.

For a full example, check out the chat-server example.

Dependencies

~11–18MB
~330K SLoC