Tutorial by Examples

Firstly it's important to note that when a new socket is created it is assigned a unique Id which is retrieved by calling socket.id. This id can then be stored within a user object and we can assign an identifier such as a username which has been used in this example to retrieve user objects. /** ...
On the server: var express = require('express'); var socketio = require('socket.io'); var app = express(); var server = http.createServer(app); var io = socketio(server); io.on('connect', function (socket) { socket.on('userConnected', socket.join); socket.on('userDisconnected', socke...
This example shows how you might handle users interacting with modals on a 1-1 basis. //client side function modals(socket) { this.sendModalOpen = (modalIdentifier) => { socket.emit('openedModal', { modal: modalIdentifier }); }; this.closeModa...

Page 1 of 1