https://github.com/zbrdeev/webchaussette
Fast, powerful, and easy-to-set-up WebSocket library
https://github.com/zbrdeev/webchaussette
fast rust websocket
Last synced: about 1 year ago
JSON representation
Fast, powerful, and easy-to-set-up WebSocket library
- Host: GitHub
- URL: https://github.com/zbrdeev/webchaussette
- Owner: ZbrDeev
- License: mit
- Created: 2024-04-14T17:14:02.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-25T20:04:50.000Z (about 2 years ago)
- Last Synced: 2024-12-28T01:22:28.256Z (over 1 year ago)
- Topics: fast, rust, websocket
- Language: Rust
- Homepage:
- Size: 69.3 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Webchaussette
##### Fast, powerful, and easy-to-set-up WebSocket library
[](https://crates.io/crates/Webchaussette)
[](https://docs.rs/webchaussette)
[](https://opensource.org/licenses/MIT)
## Installation
To use this library, simply add it to your `Cargo.toml` :
```toml
[dependencies]
webchaussette = "1.0"
async-trait = "0.1"
tokio = "1"
```
## Example
```rust
use webchaussette::server::{EventHandler, Public, Server, Types};
// Implement the field if you wish
struct Test;
#[async_trait::async_trait]
impl EventHandler for Test {
// Read incoming user data
async fn on_message(&self, public: &mut Public) {
match &public.message {
Types::String(val) => println!("{}", val),
Types::Binary(val) => println!("{:?}", val),
}
}
async fn on_close(&self) {
println!("The user has left");
}
}
#[tokio::main]
async fn main() {
let mut server: Server = Server::new("0.0.0.0:8080").await;
server.set_handler(Box::new(Test));
server.run().await;
}
```
## Documentation
Documentation is being processed !
## Contribution
Contributions are welcome! Feel free to open issues or send pull requests.
## License
This project is licensed under MIT. See the [LICENSE](LICENSE) file for more details