1.0.1 • Published 8 years ago

crm v1.0.1

Weekly downloads
7
License
-
Repository
-
Last release
8 years ago

crm

Client and room manager for chat applications with socket.io

How to use

// Include var crm = require('crm');

// Namespace var nsp = io.of("/chat");

nsp.on('connection', function (socket) { // Create a readable unique ID uClientID = crm.createUniqueClientID("Guest");

// Assign a client to the manager
crm.addClient(uClientID, "DefaultRoom");

// Get number of connected clients in a namespace.
crm.amountOfConnectedClients(null);

// Get number of connected clients in a room.
crm.amountOfConnectedClients("RoomName");

// Get connected clients in a namespace
crm.getClients(null);

// Get connected clients in a room
crm.getClients("RoomName");

// Remove a client from the manager
crm.removeClient(uClientID);

// Change a client ID (new one will be unique)
uClientID = crm.changeClientID(uClientID, "NewID");

}

License

MIT

1.0.1

8 years ago

1.0.0

8 years ago