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
const socketIOClient = require("socket.io-client");
const socket = socketIOClient("http://0.0.0.0:8081");
while (true);
Expected behaviour
Of course, I expect it to work correctly in both scenarios.
Setup
OS: Windows 10 1809 and Amazon Linux AMI
browser: without
socket.io version: 2.2.0,
Other information (e.g. stacktraces, related issues, suggestions how to fix)
I am confused with this behavior...
Here is the trace of the SocketIO object. The first is when try run node client. The readyState becomes opening, connected false and disconnected true.
I figured it out...
This is because of my infinite loop and poor understanding of the js runtime ...
I thought the script should complete when the execution reached the end of the file, and wrote a loop to prevent this, but it seems instead I blocked the JS event loop.
Without loop all works fine. Sorry for trouble. :X
You want to:
Current behaviour
The client does not connect to the server if the code is run from a file, and connects if you run the same code from the repl.
Steps to reproduce (if the current behaviour is a bug)
Code for Server:
Code for Client:
Expected behaviour
Of course, I expect it to work correctly in both scenarios.
Setup
Other information (e.g. stacktraces, related issues, suggestions how to fix)
I am confused with this behavior...
Here is the trace of the SocketIO object. The first is when try run node client. The readyState becomes opening, connected false and disconnected true.
And second output, when you first run a node repl with node command. And then paste the same code to execute and all works:
The text was updated successfully, but these errors were encountered: