Closed olimungo closed 9 years ago
Hi, I got the same problem. According to code it is not possible to do so.
I use hack based on monkey patching. It is not a best option but it works.
(function() {
// saving original function
var _connect = io.connect;
io.connect = function() {
return _connect.apply(io, ['domain.com']);
};
})();
I'll fix this. Currently I use socket.io globally and then I use your connection in AngularJS.
init.js
window.socket = io.connect('domain.com');
This solution does not work for me, conosle.log(socket) === undefined
console.log(io);
Returns undefined?
/socket.io/socket.io.js
is included before window.socket
? because this works for me.
script(type='text/javascript', src='/socket.io/socket.io.js')
script(type='text/javascript').
window.socket = io.connect('domain.com');
script(type='text/javascript', src='/lib/ng-socket/ngSocket.js')
angular.module('ngSocket', []).factory('$socket', ['$rootScope', function ($rootScope) {
console.log(socket);
//Check if socket is undefined
if (typeof socket === 'undefined') {
var socket = io.connect();
}
undefined
I'll be reviewing this implementation. Is also very old.
This feature was implemented by @dprothero. Update to version 0.1.2
Hi,
I can't find how to specify the server:port where the client has to connect ? Can you help me, please.
Thank you, Olivier