WebSocket over Node.js / Demo
Install
npm install websocket-over-nodejscd node_modules/websocket-over-nodejsnode server.js
Now open https://localhost:9449/
or use this wss://localhost.com:9449/
.
How to use?
openSocket
is used in all standalone WebRTC Experiments. You can define this method in your ui.js
file or in your HTML page.
var SIGNALING_SERVER = 'wss://localhost.com:9449/';var config = { configchannel = configchannel || 'main-public-channel'; var websocket = SIGNALING_SERVER; websocketchannel = configchannel; websocket { websocket; if configcallback config; }; websocket { config; }; websocketpush = websocketsend; websocket { websocket; }; };
Presence Detection
You can detect presence of any channel/room; and invoke open/join methods accordingly!
// use "channel" as sessionid or use custom sessionid!var roomid = connectionchannel; var SIGNALING_SERVER = 'wss://localhost.com:9449/';var websocket = SIGNALING_SERVER; websocket { var data = JSON; if dataisChannelPresent == false connection; else connection; }; websocket { websocket;};
License
WebSocket over Node.js is released under MIT licence . Copyright (c) Muaz Khan.