mirror of
https://github.com/Hopiu/postal.js.git
synced 2026-03-17 06:30:23 +00:00
26 lines
No EOL
807 B
JavaScript
26 lines
No EOL
807 B
JavaScript
var socket, port;
|
|
|
|
$( function () {
|
|
port = window.location.port
|
|
socket = io.connect( "http://" + document.domain + ':' + port + '/' );
|
|
socket.on( 'connect', function () {
|
|
socket.on( 'refresh', function () {
|
|
window.location.reload();
|
|
} );
|
|
socket.on( 'reconnecting', function () {
|
|
console.log( 'Lost connection to anvil, attempting to reconnect', 'warning' );
|
|
} );
|
|
socket.on( 'reconnect', function () {
|
|
alert( 'Reconnection to anvil succeeded' );
|
|
} );
|
|
socket.on( 'reconnect_failed', function () {
|
|
console.log( 'Reconnected to anvil failed', 'error' );
|
|
} );
|
|
socket.on( 'connect_failed', function () {
|
|
console.log( 'Could not connect to anvil', 'error' );
|
|
} );
|
|
socket.on( 'disconnect', function () {
|
|
alert( 'Anvil server has disconnected', 'error' );
|
|
} );
|
|
} );
|
|
} ); |