Coder Social home page Coder Social logo

Comments (3)

kelnos avatar kelnos commented on June 7, 2024 1

I'm running into this too (I think?), using socketioxide 0.8 (I'm using warp 0.3), acting as a server for the openHAB cloud connector (source).

The cloud connector responds to proxy requests from the socketio server by sending a responseHeader event, followed by one or more responseContentBinary events, terminated with a responseFinished event. When making a request, I usually see ordering (from the socketioxide server's perspective) like:

responseHeader
responseContentBinary
responseContentBinary
responseContentBinary
responseFinished
responseContentBinary

I'm not sure this is exactly the same problem: I don't think ACKs are involved at all (none of the events sent require ACKs), and it's the binary events themselves that are received by my application that are out of order, not the ACKs.

If I tell tokio to use the current_thread runtime, the problem goes away.

from socketioxide.

Totodore avatar Totodore commented on June 7, 2024

The main problem comes from here:

internal_tx: mpsc::Sender<Packet>,
. At insertion into the channel, when there is adjacent binary payload that it is needed, an atomic ordering is required.

My two main options for this are:

  • Putting a Mutex here but it would be quite bad because most of the time it is single message packet that is sent and therefore it doesn't require any locking / ordering.
  • Modifying the channel so that it takes a Vec<Packet> rather than a Packet. Adjacent binary packets would be grouped in each Vec. But most of the Vec<Packet> would be of size 1 and it would cause many new Vec alloc.

from socketioxide.

kelnos avatar kelnos commented on June 7, 2024

Hm, maybe that's not the same problem I'm seeing then. If I understand this bit of code correctly, that's for packets that are being sent out from the socketioxide server to the client. For me, I'm seeing messages in the other direction that are out of order. Which, now that I read through the engineioxide/socketioxide code some more, I don't quite understand how that could be happening, as it looks like the event is handled and sent up to the application on the same thread as it's received on from the websocket, without any queuing. So maybe the fault is in my code...

from socketioxide.

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.