socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

Reference: io is not defined

Open ezekel opened this issue 11 years ago • 3 comments

I need some help please how can I fix this problem. "io is not defined" this is how I initialize the socket.io

<script src="http://publicip:1333/socket.io/socket.io.js"></script>

This is in separate file called "myjs.js";

var socket = null;
$(function(){
     socket = io.connect('http://publicip:1333');
   //some js code here...

});

what makes me wrong in initializing the socket.io ?

Thank you in advance.

ezekel avatar May 26 '15 18:05 ezekel

You are loading "myjs.js" after the socket.io script?

ccarterc avatar May 27 '15 20:05 ccarterc

I wonder if your socket.io.js script loads. Usually, you have to move it to a more accessible folder ar node_modules folder can't be accessed directly from browser. Better, store the client side socket.io (Look in readme for url) in a "public" directory.

maxzeroedge avatar Jul 05 '15 16:07 maxzeroedge

That issue was closed automatically. Please check if your issue is fixed with the latest release, and reopen if needed (with a fiddle reproducing the issue if possible).

darrachequesne avatar Jan 12 '17 15:01 darrachequesne