7 releases

0.2.5 Jul 24, 2023
0.2.4 Jul 24, 2023
0.1.0 Jul 24, 2023

#147 in WebSocket

Download history 6/week @ 2024-02-19 4/week @ 2024-02-26 1/week @ 2024-03-11 77/week @ 2024-04-01

78 downloads per month

MIT license

62KB
1K SLoC

Degen Websockets

A websocket server and client framework supporting:

  • Reliable messaging (option)
  • Broadcast-to-all, Specific-destination or Room-based destinations for messages

Install

cargo add degen-websockets

Examples

See main.rs

Custom messages

You can define your own inner messages to send through the socket server. They just need to implement Serialize/Deserialize and MessageReliability as follows:

#[derive(Serialize,Deserialize)]
struct MyCustomMessage {
    
    color: String
}

impl MessageReliability for MyCustomMessage {
    
         fn get_reliability_type(&self, msg_uuid:String) -> MessageReliabilityType{
             return MessageReliabilityType::Reliable( msg_uuid )
         }
}
 

Dependencies

~6–18MB
~237K SLoC