https://github.com/woodgear/socketio-client-rust
socketio-client-rust is rust implement of socket.io-client,which treat socket.io stream as future stream.
https://github.com/woodgear/socketio-client-rust
rust socket-io socket-io-client
Last synced: 2 months ago
JSON representation
socketio-client-rust is rust implement of socket.io-client,which treat socket.io stream as future stream.
- Host: GitHub
- URL: https://github.com/woodgear/socketio-client-rust
- Owner: woodgear
- Created: 2019-06-02T13:59:33.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2019-06-02T14:00:31.000Z (about 7 years ago)
- Last Synced: 2025-08-03T23:46:29.144Z (11 months ago)
- Topics: rust, socket-io, socket-io-client
- Language: Rust
- Homepage:
- Size: 19.5 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SocketIo-Client-Rust
socketio-client-rust is rust implement of [socket.io-client](https://github.com/socketio/socket.io-client),which treat socket.io stream as future stream.
# How to use
you could refer to examples/socketio_cli. to run this example you must launch a socket.io server under port 3000.
```rust
//some code
fn run() -> impl Future {
const URL: &'static str = "ws://localhost:3000/socket.io/?EIO=3&transport=websocket";
let runner = SocketIoStream::new(URL)
.unwrap()
.and_then(|ss: SocketIoStream| {
let (sink, ss_stream) = ss.split();
let f1 = socket_io_control_stream().forward(sink).map(|(_, _)| ());
let f2 = ss_stream.for_each(|e| {
println!("event {:?}", e);
Ok(())
});
let f = f1.join(f2).map(|(_, _)| ());
return f;
});
return runner;
}
```