Reputation: 880
I'm using Socket.io in my nodejs project. In order to use socket.io I should use two javascript files in client side:
The first one is socket.io-1.3.5.js
The second one is a javascript file that exists in this local url: /socket.io/socket.io.js.
As I understand, you should reference the first file before the second one. But this will result in an error when I run the server:
Uncaught TypeError: object is not a function
And it's refering to this line of the second file:
query[this.timestampParam] = +new Date + '-' + Transport.timestamps++;
I've installed socket.io. What do I do?
Thanks.
Upvotes: 1
Views: 63
Reputation: 880
The problem I had here, was a rather stupid one.
The /socket.io/socket.io.js file and socket.io-1.3.5.js both use a Date class.
I had written a script file in my project that also had a line like this: var date = new Date()
which was being mixed up with the Date class that those two were using and was casuing this.
It's highly unlikely that anyone encounteres the same problem, but similar cases might happen in any project so I decided to post this here.
Upvotes: 1