Coder Social home page Coder Social logo

Is it possible to modify the server.rs example to send the message to all clients connected to the server about rust-websocket HOT 4 CLOSED

websockets-rs avatar websockets-rs commented on August 23, 2024 3
Is it possible to modify the server.rs example to send the message to all clients connected to the server

from rust-websocket.

Comments (4)

illegalprime avatar illegalprime commented on August 23, 2024

@ivanceras what's wrong with looping through all the connected clients?

from rust-websocket.

illegalprime avatar illegalprime commented on August 23, 2024

you can check if there's any new messages by setting nonblocking, it would be easier if the library was made for evented things.
closing for now.

from rust-websocket.

jackbit avatar jackbit commented on August 23, 2024

interested to know how to do it, can you give some example?

from rust-websocket.

illegalprime avatar illegalprime commented on August 23, 2024

@jackbit yeah now it's easier with the added tokio support. I'm at work now so I can't write an example, but the idea is to split the clients into their readable and writable components, select on all the readable components + the server to get new clients, then make a chain and send to all the writable components of the clients.

from rust-websocket.

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.