chat-example icon indicating copy to clipboard operation
chat-example copied to clipboard

Uncaught TypeError: undefined is not a function

Open mondain opened this issue 11 years ago • 3 comments

I get this error when changing a single line in your index.html

var socket = io();

to

var socket = new WebSocket('ws://192.168.1.174:10080/mcu');

I am not using Node.js, but my server does support websockets. Any idea you may have as to how I can fix this would be awesome.

screenshot from 2014-06-11 11 18 24

mondain avatar Jun 11 '14 18:06 mondain

Using node works without an issue. My guess is .emit and .on functions don't work as well with standard ws

arshem avatar Jun 16 '14 23:06 arshem

So node its sending something to make it valid? Seems odd, but ok.

On Jun 16, 2014 4:02 PM, "arshem" [email protected] wrote:

Using node works without an issue. My guess is .emit and .on functions don't work as well with standard ws

— Reply to this email directly or view it on GitHub.

mondain avatar Jun 17 '14 00:06 mondain

I get the same error on running on

  • server
    • node.js v0.10.32
    • OSX 10.9.5
  • client
    • Chrome Version 40.0.2173.0 canary (64-bit)

I changed

var socket = io();

to

var socket = io.connect();

and it works.
Unfortunately I don't know why.

patownle avatar Oct 05 '14 22:10 patownle