-
Notifications
You must be signed in to change notification settings - Fork 0
WebSockets
Kyle Coberly edited this page Aug 6, 2017
·
1 revision
npm install --save ws- Web sockets are bi-directional
- Not fully supported in browsers
- Need a web socket server
- long-lived XHR request
-
ws.send,ws.on new WebSocket- Use libraries:
socket.io,engine.io,sock.js
io.on("connection", function(socket){
socket.on("chat message", function(message){
io.emit("chat message", message);
});
});
socket.on("chat message", function(message){
});- Primus is an abstraction-abstraction
primusServer = new Primus;
primusServer.on("connection", function(socket){
socket.on("data" function(message){
});
});