Search code examples
jquerysocket.ioconflictimpactjs

Jquery and Socket.io conflict


I'm trying to use ImpactJS, a JS framework. I want to add socket.io functions. As soon as I add socket.io there is an error

Uncaught ReferenceError: sock is not defined jquery-1.7.1.min.js:4

My class where I use soket.io :here (end of the file)

My index.html : here

I don't understand why I can't use both. Thx for your help.


Solution

  • I find the problem. Socket is loaded in index.html and not in Player.js.

    Map editor can't load socket. To solve this problem in Player.js :

    if (typeof sock != 'undefined')
    sock.emit('update', this.padmap, this.id);