Comments (4)
Hi, thanks for using the crate! You're right, there are no functions concerning rooms, but that's because this crate currently only implements the client and rooms is a fully server side feature. That means managing rooms in any way is done on the server side, a client does not have any information about which room he's in or even which rooms exist on the server side. For further reading visit the official socket.io documentation. An example using this client would look something like this:
server code
// assume you've set up the server somehow
io.on('connection', function(socket) {
// you can join (leave) a room by calling the join (leave) method
socket.on('room', function(room) {
socket.join(room);
});
});
// this emits to all clients in the room
io.sockets.in("room1").emit('message', 'what is going on, party people?');
client code
use serde_json::json;
// ...
// assume you've connected the client and defined callbacks for certain events
let payload = json!("room1");
socket.emit("room", payload).expect("Server unreachable");
from rust-socketio.
I see, rust-socketio is only a client crate.
Thanks a lot. @1c3t3a
from rust-socketio.
Do you have any plan to implement socketio server side features?
from rust-socketio.
Actually yes, there is a tracking issue for this (#32). I will tackle it as soon as possible, but if you're interested, feel free to implement it ;)
from rust-socketio.
Related Issues (20)
- Server support HOT 2
- error add overflow when reconnect HOT 5
- Rust socket io server implementation? HOT 2
- EngineIO does not timeout on missing pings
- Event handler lifetime shouldn't be static HOT 4
- Add feature to use rustls instead of native-tls HOT 1
- Buffer is not supported when it's a field in an JS object? HOT 2
- Manual disconnect doesn't block reconnecting HOT 1
- Add support for WebTransport HOT 2
- add macro to simplyfy async callback define HOT 4
- Allow async connections to update auth when reconnecting HOT 4
- [feature request] custom-parser support HOT 5
- Unable to cross-compile for android HOT 1
- Multiple payload still broke HOT 2
- when using binary buf data with emit_with_ack function callback is not executed
- Is it possible to add `.on()` event callback after connect like in JavaScript? HOT 1
- Unable to use shared variable in async callback HOT 4
- Binary Data event names incorrectly handled HOT 1
- Introduce Custom shared data structure
- [bug] unable to connect to an http based socketio server HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-socketio.