Giter Site home page Giter Site logo

Comments (4)

1c3t3a avatar 1c3t3a commented on July 23, 2024

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.

rts-gordon avatar rts-gordon commented on July 23, 2024

I see, rust-socketio is only a client crate.

Thanks a lot. @1c3t3a

from rust-socketio.

rts-gordon avatar rts-gordon commented on July 23, 2024

Do you have any plan to implement socketio server side features?

from rust-socketio.

1c3t3a avatar 1c3t3a commented on July 23, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.