reconnecting-websocket
reconnecting-websocket copied to clipboard
Nodejs
Is this a nodejs library? How to use it in nodejs? npm install ?
https://www.npmjs.com/package/reconnectingwebsocket
Issue #73 is pointing out that it assumes browser environment. Could this represent a problem when using the library in a server-side app?
How should the library be used as a node module? I tried the following without success:
Installer from npm npm install --save reconnectingwebsocket
var ReconnectingWebSocket = require('reconnectingwebsocket');
ws = new ReconnectingWebSocket("ws://192.168.60.80/PSIA/Metadata/stream?AreaControlEvents=true");
The returned error message:
C:\projets\ws\app2.js:9
ws = new ReconnectingWebSocket("ws://192.168.60.80/PSIA/Metadata/stream?AreaControlEvents=true");
^
TypeError: ReconnectingWebSocket is not a function
at Object.<anonymous> (C:\projets\ws\app2.js:9:8)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Function.Module.runMain (module.js:467:10)
at startup (node.js:136:18)
at node.js:963:3
[nodemon] app crashed - waiting for file changes before starting...
This package is for the browser's implementation of WebSocket. Use the ws
package for a node.js client WebSocket implementation.