After calling socket.disconnect()
on the client side, I try to reconnect that client io.connect("http://localhost:8000")
but the socket does not seem to be created. Is this possible to do without a page refresh?
If you have a socket created with something like
var connection = io.connect();
in your client-side JS, you can reconnect via
connection.socket.connect();
A typical use case would be
var socket;
var firstconnect = true;
function connect() {
if(firstconnect) {
socket = io.connect();
... do something else
firstconnect = false;
}
else {
socket.socket.reconnect();
}