Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var socket = io.connect();
- socket.on('connect', function () {
- alert('Socket is connected.');
- });
- socket.on('disconnect', function () {
- alert('Socket is disconnected.');
- });
- var socket = io.connect('http://<ip>:<port>', {
- reconnection: false
- });
- socket.on('connect_error', function() {
- console.log('Failed to connect to server');
- });
- var socket;
- try {
- socket = io();
- }
- catch() {
- window.location = "nodeServerDown.php";
- }
Add Comment
Please, Sign In to add comment