We're going to do is add a few cases right here, in chat.js:
socket.on('connect', function () { var params = jQuery.deparam(window.location.search); socket.emit('join', params, function (err) { if(err) { } else { } }); });
If it is an error that's a pretty big problem, and we're going to want to send the user back to the root of the application by changing one of the properties under location, window.location.href. Here we can manipulate which page the user's on, essentially we're going to be redirecting them back to that root page by having the forward slash (/) value set to the href property:
socket.on('connect', function () { var params = jQuery.deparam(window.location.search); socket.emit('join', params, ...