Update socket.io.client.service.js

This commit is contained in:
David Baldwynn 2017-04-20 21:23:21 -07:00 committed by GitHub
parent 27b8aad4af
commit cc1b0bdf98

View file

@ -9,18 +9,6 @@
Socket.$inject = ['$timeout', '$window'];
function Socket($timeout, $window) {
var service = {
connect: connect,
emit: emit,
on: on,
removeListener: removeListener,
socket: null
};
connect(window.location.protocol+'//'+window.location.hostname);
return service;
// Connect to Socket.io server
function connect(url) {
service.socket = io(url, {'transports': ['websocket', 'polling']});
@ -50,5 +38,18 @@
service.socket.removeListener(eventName);
}
}
var service = {
connect: connect,
emit: emit,
on: on,
removeListener: removeListener,
socket: null
};
connect(window.location.protocol+'//'+window.location.hostname);
return service;
}
}());