GithubHelp home page GithubHelp logo

Conflation about engine.io HOT 12 CLOSED

socketio avatar socketio commented on July 18, 2024
Conflation

from engine.io.

Comments (12)

EugenDueck avatar EugenDueck commented on July 18, 2024

Somehow I must have forgotten to paste in the footnote that I refer to in the text. So I'll try to reproduce it:

[1] This could be implemented by either one of following or some combination, potentially configurable:

  • Make the buffer bounded, and when it gets full, kick client
  • Use a ring buffer, where older entries get overwritten
  • Call buffer = conflate(buffer) when buffer is full - but this depends on conflate(buffer) returning less elements than it receives, but that could be checked, and a fallback to kick client could be implemented

from engine.io.

EugenDueck avatar EugenDueck commented on July 18, 2024

Quoting my last statement:

... depends on conflate(buffer) returning less elements than it receives

This reminds me that calling this feature conflation would probably be too narrow. If I'll come up with a better name, I'll post it here, but conceptually, this is a general feature that lets application code manipulate (conflate, augment, modify) the buffer, just before being actually sent to a client. Somewhat long for a name...

from engine.io.

rauchg avatar rauchg commented on July 18, 2024

I want this

from engine.io.

rauchg avatar rauchg commented on July 18, 2024

@EugenDueck I wonder if all that we should do is add a callback to send. In the case of websocket, we fire when the ws transport fires the callback. In the case of polling, when the incoming GET poll request consumes the message.

Then it's up to a higher-level impl to decide on the conflation mechanics.

from engine.io.

EugenDueck avatar EugenDueck commented on July 18, 2024

I wonder if all that we should do is add a callback to send.

That's basically what I'm doing, except that - in my socket.io implementation that I just tested yesterday and it seems fine - I wrap the packets in a new Packet class, which holds and caches

  • the data variant of the packet (i.e. the JS object)
  • the on-the-wire variant of the packet

It offers methods getAsData and getAsOnTheWireOrSomething (i forgot the exact name I used). Those are the ones that are used by socket.io, and those methods will create the representation if it does not exist and cache it for reuse.

Otherwise there'd be a lot of waste in back- and forth-encoding, especially with multicast (rooms) and broadcast.

Will try to prepare a engine.io variant of it as soon as time permits. Question: Do you agree that the callback (provided by the app that is using socket.io/engine.io) should not see the on-the-wire representation but the JS object?

from engine.io.

rauchg avatar rauchg commented on July 18, 2024

Agreed completely. In fact, in engine.io Socket hols an array of packet objects, and only the Transport deals with encoding logic.

from engine.io.

EugenDueck avatar EugenDueck commented on July 18, 2024

Alright. Will hopefully get a pull-request done later today.

Question about the rough timeline. When talking engine.io 1.0, are you talking days, or weeks, or months?

from engine.io.

rauchg avatar rauchg commented on July 18, 2024

Days

from engine.io.

EugenDueck avatar EugenDueck commented on July 18, 2024

Gotcha. One more question about the big picture: As I don't see them in engine.io: stores will stay in socket.io?

from engine.io.

rauchg avatar rauchg commented on July 18, 2024

Yep. In fact, that's why I want the reliable messaging layer directly in socket.io. It'd be really cool if processes could die, come and go, yet messages stay in let's say redis.

from engine.io.

EugenDueck avatar EugenDueck commented on July 18, 2024

Indeed.

I'm sorry this is getting even more off-topic, but in terms of the big picture, which it is good to always have when making non-trivial changes: Does (the current and/or the future) socket.io's RedisStore allow to non-sticky sessioned load balancing? (Just haven't had the time to dig into it yet)

from engine.io.

rauchg avatar rauchg commented on July 18, 2024

Per discussion, we're moving it into a different module.

from engine.io.

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.