<script src="/socket.io/socket.io.js"></script>
<script>
    var socket = io.connect('http://localhost:8888');
    socket.on('connected', function (data) {
        console.log(data);
        socket.emit('subscribe', {'username':'tegioz', 'rooms':['pruebas']});
        socket.emit('newMessage', {'room':'pruebas', 'msg':'Holaaaaaa'});
    });
    socket.on('newMessage', function (data) {
        console.log("newMessage: %s", JSON.stringify(data));
    });
    setInterval(function() {
        socket.emit('unsubscribe', {'rooms':['pruebas']});
        socket.disconnect();
    }, 600000);
</script>

<script src="/socket.io/socket.io.js"></script>
<script>
    var socket = io.connect(window.location.host);
    socket.on('connected', function (data) {
        console.log(data);
        socket.emit('subscribe', {'username':'tegioz', 'rooms':['pruebas']});
        socket.emit('newMessage', {'room':'pruebas', 'msg':'Holaaaaaa'});
    });
    socket.on('newMessage', function (data) {
        console.log("newMessage: %s", JSON.stringify(data));
    });
    setInterval(function() {
        socket.emit('unsubscribe', {'rooms':['pruebas']});
        socket.disconnect();
    }, 600000);
</script>

Remove hardcoding to localhost and port 8888 and pick the location from the browser instead
Remove hardcoding to localhost and port 8888 and pick the location from the browser instead