angular-socket-io icon indicating copy to clipboard operation
angular-socket-io copied to clipboard

can't find io.connect?!

Open dotku opened this issue 10 years ago • 5 comments

I was trying to intergrate socket.io with meanjs following by this article: https://vexxhost.com/resources/tutorials/mean-socket-io-integration-tutorial/

I got io is not defined error on file 'public\modules\articles\services\socket.client.service.js'

'use strict';

//socket factory that provides the socket service
angular.module('core').factory('Socket', ['socketFactory',
    function(socketFactory) {
        return socketFactory({
            prefix: '',
            ioSocket: io.connect('http://localhost:3000')
        });
    }
]);

dotku avatar Aug 29 '15 05:08 dotku

you need to load socket.io before you try to use it in angular

shawn-simon avatar Sep 02 '15 00:09 shawn-simon

i'm seeing this error also. i'm not sure what you mean @shawn-simon. shouldn't dependency injection take care of this or are you saying we need to also add another dependency to the angular app aside from btford.socket-io?

gad2103 avatar Sep 25 '15 18:09 gad2103

i think you mean we need to load socket.io-client, before we load this library but there isn't a bower component so you need to use overrides if you bower install this package. https://github.com/socketio/socket.io-client

i think the README should be explicit about this dependency.

gad2103 avatar Sep 25 '15 19:09 gad2103

i think the README should be explicit about this dependency.

PR welcome

btford avatar Sep 27 '15 08:09 btford

Will send along when I get a chance to. Thanks!

On Sun, Sep 27, 2015, 4:23 AM Brian Ford [email protected] wrote:

i think the README should be explicit about this dependency.

PR welcome

— Reply to this email directly or view it on GitHub https://github.com/btford/angular-socket-io/issues/118#issuecomment-143528652 .

gad2103 avatar Sep 27 '15 12:09 gad2103