Error Using Socket.io Client Side Files in a Nodejs Project

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.

Answers


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.


Need Your Help

MySQL to MongoDB conversion

mysql ruby-on-rails ruby-on-rails-3 mongodb mongoid

How do I convert the following into MongoDB query ?

Is it possible to use cyrillic symbols in Lumen(by Laravel)?

php laravel utf-8 lumen cyrillic

The issue is I can't use any russian symbols in the response()->json() method.