Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find socket.io.js [duplicate]

Possible Duplicate:
socket.io.js not found

I am using the most up to date version of Socket.IO and I'm trying the first example on the how to use page, however, I'm getting an error when I try to get to '/socket.io/socket.io.js'

The javascript console saying the file doesn't exist. When I check my browser (both http://socket.io/socket.io.js and https://socket.io/socket.io.js), it isn't up there either. Is the documentation out of date? Where is the socket.io.js file that I'm supposed to include?

I am running this on a Mac with NodeJS running my app.js server.

I've tried using "http://cdn.socket.io/stable/socket.io.js" but it seems that is an old version (0.6) and the Javascript console says it doesn't have the "connect" function. (which is weird, I would think that connect is a rather integral function to have in such a library, but I guess not)

like image 222
Esaevian Avatar asked Dec 31 '11 18:12

Esaevian


1 Answers

Your Socket.IO server will handle serving the correct version of the Socket.IO client library; you should not be using one from elsewhere on the Internet. From the top example on the Socket.IO website:

<script src="/socket.io/socket.io.js"></script>

This works because you wrap your HTTP server in Socket.IO (see the example at How To Use) and it intercepts requests for /socket.io/socket.io.js and sends the appropriate response automatically.

like image 66
Michelle Tilley Avatar answered Sep 22 '22 01:09

Michelle Tilley