degen-websockets

Crates.iodegen-websockets
lib.rsdegen-websockets
version0.2.5
sourcesrc
created_at2023-07-24 00:13:44.220261
updated_at2023-07-24 04:31:45.177398
descriptionYet Another WebSocket Server
homepage
repositoryhttps://github.com/ethereumdegen/degen-websockets
max_upload_size
id924094
size84,620
Ethereumdegen (ethereumdegen)

documentation

README

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 )
         }
}
 

Commit count: 23

cargo fmt