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?
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With