question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why are volatile messages rapidly sent by the server not being received by the client?

See original GitHub issue

You want to:

  • report a bug
  • request a feature

Current behaviour

When firing off multiple emits from the server, I am getting a behavior I was not expecting for volatile messages.

When I do a regular emit in rapid succession via a loop, all messages are received by the client and can be inspected via chrome network inspector. When I change to doing volatile.emit, I am only receiving the first message (of 100).

The question is, why is this the case?

Additionally, I noticed that if I had a 50ms delay to sending each volatile.emit message via setTimeout() then all messages are sent correctly (but of course with a delay). What factors go into this method working as expected, but not immediate volatile.emits working like regular emits?

Steps to reproduce (if the current behaviour is a bug)

Below is a link to a repo that is a setup of my test between volatile and non volatile messages. https://github.com/GStipick/socketioVolatileTest

Expected behaviour

From my understanding of: The Documentation for volatile messages , I would expect all of the messages to be sent, even if they are not received by the client. If they are indeed being sent, then why is emit able to be received for all messages, while volatile.emit is not?

Setup

  • OS: Windows 10 (Version 1803) [OS Build 17134.285]
  • browser: Firefox/Chrome
  • socket.io version: 2.1.1
  • node.js version: 10.9.0

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
darrachequesnecommented, Mar 4, 2021

For future readers:

Please see the documentation here: https://socket.io/docs/v3/emitting-events/#Volatile-events

1reaction
darrachequesnecommented, Apr 5, 2022

@wmcmurray that’s a good point, actually! I was not able to find the initial motivation for this feature, which was implemented a while ago.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Socket.io - Why are volatile messages rapidly sent by the ...
This means that when the server is going to send a message, if it finds that the output buffer for the socket is...
Read more >
Socket.IO 3 - Best HTTP/2 Documentation
Its first parameter is the name of the event, followed by any number of parameters. Volatile Events. A volatile event isn't sent when...
Read more >
Email not sending - Things to do to solve sending issues
So, why sometimes your mail client is not sending emails? Maybe it keeps on receiving them, but the outgoing emails are not sent...
Read more >
Emitting events | Socket.IO
Volatile events are events that will not be sent if the underlying connection is not ready (a bit like UDP, in terms of...
Read more >
How the NFS Service Works - System Administration Guide
When the grace period has ended, the following message is displayed. NFS server recovery ok. The client can now send new open and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found