javascript - Object #<Object> has no method 'connect' -


I'm getting this error on the console .... My HTML code is simple and socket server successfully follow code : / P>

  & lt; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Script src = "http://cdn.socket.io/stable/socket.io.js" & gt; & Lt; / Script & gt; & Lt; Script & gt; Var socket = io.connect ('ws: // localhost: 3000'); Socket.on ('news', function (data) {console.log (data); socket.emit ('my other event', {my: 'data'});}); & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; Welcome Sockets.IO  

  Var socket = new io.Socket ('localhost', {port: 8080}); Socket.connect ();  

This can work, just change the value according to your one.

You should check this link, it will help you


Comments