You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've searched for any related issues and avoided creating a duplicate issue.
Description
Hello,
I have a question about whether this is a bug or an unusual situation.
I'm sending ping requests from NextJS (localhost:3000) to NodeJS (localhost:8080). I create the ping request myself and send the current time using Date.now() to port 8080 and get it back.
I subtract the timestamp in the message from Date.now() when I receive the message and divide by 2.
This creates a difference of around 13~18ms. I think this difference is quite high for websocket communication between two ports on localhost.
Can I get information about this situation? Are these numbers normal?
ws version
8.18.0
Node.js Version
22.0.0
System
System:
OS: macOS 15.1.1
CPU: (11) arm64 Apple M3 Pro
Memory: 99.66 MB / 18.00 GB
Shell: 3.2.57 - /bin/sh
Expected result
No response
Actual result
No response
Attachments
No response
The text was updated successfully, but these errors were encountered:
The numbers are unusual but it has nothing to do ws. I think it is more a network issue. Below is an example in my environment.
// server.mjsimport{WebSocketServer}from'ws';constwebsocketServer=newWebSocketServer({port: 8080},function(){console.log('Server listening on port *:8080');});
$ node client.mjs
Round-trip time: 2 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 0 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 1 ms
Round-trip time: 0 ms
Round-trip time: 1 ms
...
Thank you @lpinca ;
I examined your example code and applied it for testing. I'm getting similar results. I think I'm running into some browser or Next.js related factors here. Thank you for your interest.
Is there an existing issue for this?
Description
Hello,
I have a question about whether this is a bug or an unusual situation.
I'm sending ping requests from NextJS (localhost:3000) to NodeJS (localhost:8080). I create the ping request myself and send the current time using Date.now() to port 8080 and get it back.
I subtract the timestamp in the message from Date.now() when I receive the message and divide by 2.
This creates a difference of around 13~18ms. I think this difference is quite high for websocket communication between two ports on localhost.
Can I get information about this situation? Are these numbers normal?
ws version
8.18.0
Node.js Version
22.0.0
System
System:
OS: macOS 15.1.1
CPU: (11) arm64 Apple M3 Pro
Memory: 99.66 MB / 18.00 GB
Shell: 3.2.57 - /bin/sh
Expected result
No response
Actual result
No response
Attachments
No response
The text was updated successfully, but these errors were encountered: