Exit gracefully if server is not running instead of waiting forever

This commit is contained in:
Jerome Petazzoni
2017-12-21 05:29:45 +01:00
parent ec7b46b779
commit 718031565e

View File

@@ -8,6 +8,10 @@
var io = require('socket.io-client');
var socket = io('http://localhost:3000');
socket.emit('slide change', process.argv[2], function () {
socket.close();
socket.on('connect_error', function(){
console.log('connection error');
socket.close();
});
socket.emit('slide change', process.argv[2], function(){
socket.close();
});