Comments (12)
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 onconflate(buffer)
returning less elements than it receives, but that could be checked, and a fallback to kick client could be implemented
from engine.io.
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.
I want this
from engine.io.
@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.
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.
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.
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.
Days
from engine.io.
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.
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.
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.
Per discussion, we're moving it into a different module.
from engine.io.
Related Issues (20)
- TypeError: Cannot destructure property 'Server' of '_engineIo.default' HOT 5
- Customize response headers with Express middleware HOT 6
- Possible error in websocket code HOT 2
- clientsCount property of server... why need to keep this private, HOT 1
- In package.json, move @types/* from dependencies to devDependencies HOT 9
- Log with pino-http middleware raises TypeError: res.on is not a function HOT 1
- Latest uWs not working HOT 5
- ReferenceError: TextDecoder is not defined HOT 5
- Getting unexpected messages from some clients HOT 2
- Node.js versions below 10.2 are not compatible with the latest version 6.5.1. HOT 1
- WebTransport If the length of the data block exceeds maxDatagramSize, the server will be unable to receive the complete message (the client will not send the complete message). HOT 2
- Upgrading from polling to webtransport will report engine invalid WebTransport handshake. HOT 8
- The cache busting t query parameter does not work if multiple connections to the server are made HOT 3
- Add support for Node.js built-in WebSocket? HOT 7
- Upgrade 6.5.2 but the error of uWebsocket aborted write failed still appear HOT 1
- Add new transport: gRPC-Web HOT 2
- HTTP/2 Web Socket in Chrome not working HOT 2
- Send callback may not be called if message is sent during upgrade window HOT 2
- Cannot set `socket.request` to `null` because the property is read-only
- `websocket`: `send` callbacks are not all called if multiple messages are sent rapidly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from engine.io.