Giter Club home page Giter Club logo

Comments (4)

EverlastingBugstopper avatar EverlastingBugstopper commented on August 11, 2024

Reopening this as I cannot figure out why I'm not receiving any messages for the life of me - any help is greatly appreciated.

from tokio-tungstenite.

agalakhov avatar agalakhov commented on August 11, 2024

Looks like you try to await send and receive on the same socket. In most cases this won't work. Your code isn't really asynchronous, it is blocking. Try to add trace!() to it in order to see what actually is called.

from tokio-tungstenite.

sdroege avatar sdroege commented on August 11, 2024

Awaiting the read and write side of the socket in parallel should work fine, that's one of the underlying assumptions of split() on a Sink+Stream. When space is available for writing, writing will wake, when space for reading is available then reading will wake and otherwise both are (asynchronously, non-blocking!) waiting for either of the two conditions.

But from what I can see the problem here is keep_alive(). That will busy wait with that loop until the KEEP_ALIVE_INTERVAL is reached and won't allow anything else in the same task to run in the meantime. You probably want to use tokio::time::interval() here instead for doing the same thing asynchronously.

from tokio-tungstenite.

EverlastingBugstopper avatar EverlastingBugstopper commented on August 11, 2024

@sdroege that was it!!!! Thank you so much for your help on this :)

from tokio-tungstenite.

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.