-
Notifications
You must be signed in to change notification settings - Fork 487
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Receiving "Callbacks are not support when broadcasting" when using multiple webapps via socket.emit #445
Labels
enhancement
New feature or request
Comments
Hi! That's indeed a known limitation, acknowledgements across multiple servers are not currently supported. We plan to implement it in the next release though. Related: socketio/socket.io#1811 |
darrachequesne
added a commit
to socketio/socket.io
that referenced
this issue
Mar 31, 2022
Syntax: ```js io.timeout(1000).emit("some-event", (err, responses) => { // ... }); ``` The adapter exposes two additional methods: - `broadcastWithAck(packets, opts, clientCountCallback, ack)` Similar to `broadcast(packets, opts)`, but: * `clientCountCallback()` is called with the number of clients that received the packet (can be called several times in a cluster) * `ack()` is called for each client response - `serverCount()` It returns the number of Socket.IO servers in the cluster (1 for the in-memory adapter). Those two methods will be implemented in the other adapters (Redis, Postgres, MongoDB, ...). Related: - #1811 - #4163 - socketio/socket.io-redis-adapter#445
darrachequesne
added a commit
that referenced
this issue
May 3, 2022
This feature was added in `socket.io@4.5.0`: ```js io.timeout(1000).emit("some-event", (err, responses) => { // ... }); ``` Thanks to this change, it will now work with multiple Socket.IO servers. Related: - socketio/socket.io@8b20457 - #445 - #452
Implemented in |
dzad
pushed a commit
to dzad/socket.io
that referenced
this issue
May 29, 2023
Syntax: ```js io.timeout(1000).emit("some-event", (err, responses) => { // ... }); ``` The adapter exposes two additional methods: - `broadcastWithAck(packets, opts, clientCountCallback, ack)` Similar to `broadcast(packets, opts)`, but: * `clientCountCallback()` is called with the number of clients that received the packet (can be called several times in a cluster) * `ack()` is called for each client response - `serverCount()` It returns the number of Socket.IO servers in the cluster (1 for the in-memory adapter). Those two methods will be implemented in the other adapters (Redis, Postgres, MongoDB, ...). Related: - socketio#1811 - socketio#4163 - socketio/socket.io-redis-adapter#445
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We are using socket io callbacks when sending messages to particular connections. (We use heroku for hosting)
Server emit code looks like
Client code looks like
This works fine when we only have one web server running; however when we have multiple webservers running (heroku dynos), we receive the following error when our clients try responding to the callbacks:
However we aren't broadcasting (rather emitting to one particular client)
We are configuring socket-io redis in the following way:
The text was updated successfully, but these errors were encountered: