server.close() does not work??
See original GitHub issuedescribe.only('Websockets store handlers', () => {
let store;
beforeEach(() => {
store = createStore(ws,
applyMiddleware(
thunk,
promise,
)
);
});
it('connects the websocket', () => {
const server = new Server('ws://qorus.example.com/log/main');
store.subscribe(() => {
const { data } = store.getState();
expect(data).to.eql({
'log/main': {
loading: true,
connected: false,
error: false,
paused: false,
},
});
});
store.dispatch(actions.connect('log/main'));
server.close();
});
it('disconnects the websocket', () => {
const server = new Server('ws://qorus.example.com/log/main');
store.dispatch(actions.connect('log/main'));
store.subscribe(() => {
const { data } = store.getState();
expect(data).to.eql({
'log/main': {
loading: false,
connected: false,
error: false,
paused: false,
},
});
});
store.dispatch(actions.disconnect('log/main'));
server.close();
});
});
- Websockets store handlers disconnects the websocket: Error: A mock server is already listening on this url
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How do I shutdown a Node.js http(s) server immediately?
close() will close the process, as long as there's nothing else keeping the process alive. If you need to do other things after...
Read more >HTTP server.close() does not shut down, process hangs #41895
close() is called, or check in setupListenHandle() to make sure the server is not shut down before opening the socket.
Read more >Node.js server.close() Method - W3Schools
Definition and Usage. The server.close() method stops the HTTP server from accepting new connections. All existing connections are kept.
Read more >Node.js http.server.close() Method - GeeksforGeeks
The http.server.close() is an inbuilt application programming interface of class Server within the HTTP module which is used to stop the server ...
Read more >How to terminate a HTTP server in Node.js?
server.stop() stops the server from accepting new connections and keeps existing connections. This function is asynchronous, the server is ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having a similar “already listening” problem, and I tried
and first typescript said those weren’t valid keys, and when I
@ts-ignore
that error, I still have the same ‘already listening’ problem.Sorry, It’s actually server.stop(), but that doesn’t really matter since that one does not work either 😃