-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Document 'ping' and 'pong' events in http://socket.io/docs #1022
Comments
Agreed! |
PR is welcome, as usual! |
I already considered that, but I failed to find a repository that contains the website source. Maybe I'm just incompetent or was too tired, can you point me to it? |
I just started looking at this (see here) but this comes with a need of something like a |
Closing due to inactivity, please reopen if needed. |
It's hard to know if the issue was fixed or not, due to #1054 (the page renders nothing currently). |
Is ping/pong not some real basic shit in networking? why the hell would they not be documented? There are ping and pong events sent back and fourth between the server and client automatically (upon socket connection)? If so, how do i look at these events and their timestamps to measure latency? |
Can we reopen this, I agree with ForgeableSum. We should have more documentation. |
Well it's already documented https://github.com/socketio/socket.io-client/blob/master/docs/API.md#event-ping-1 , I was struggling for hours trying to receive data from a custom ping event sent by my client, it seems that you can't override this event. 😅 |
Ugh. I just burnt loads of time here. RTFM. |
As this page is now the top result when searching for 'socket.io ping pong events': If you are making your own 'ping' and 'pong' events and they are behaving strangely, it is because socket.io is using those events internally to monitor the connection. Rename your own events to something else like 'my-ping' and 'my-pong' and they will work as expected. |
@dmlo please note that this is not true anymore in version > 3.0.0, you can totally use Reference:
Using a reserved event will now throw an error, as suggested in a comment above: // will throw an error
socket.emit("connect"); |
@darrachequesne Thank you for the clarification. I am indeed using 2.4 with NestJS. They suggest support for 3.0 is coming in the next major version. |
ping
andpong
events are undocumented in the website (socket.io/docs), potentially causing confusion when somebody tries to implement their own ping-pong system.socket.emit('pong')
on the browser does not cause anything to be sent over the socket (verified withlocalStorage.debug = '*';
), maybesocket.emit('ping')
should also report an error letting the developer know it's a reserved keyword.From README.md:
The text was updated successfully, but these errors were encountered: