Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReferenceError: WebSocket is not defined [closed]

I am running my node js server which makes use of WebSocket but on execution it says "ReferenceError: WebSocket is not defined". I am new to to this and am unable to understand why this happening - how do I resolve this?

like image 589
abhishek Avatar asked Jan 29 '14 20:01

abhishek


1 Answers

I think you're getting that line from this file, right? You're missing the line:

var WebSocket = require('ws')

which means you'll need to install ws with npm (npm install ws).

like image 52
Aaron Dufour Avatar answered Nov 01 '22 08:11

Aaron Dufour