UNPKG

kevoree-group-centralizedws

Version:

WebSocket group based on a centralized architecture that only sends partial model to connected clients

13 lines (11 loc) 331 B
const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'; module.exports = function shortid(length) { if (typeof length === 'undefined') { length = 5; } let id = ''; for (let i = 0; i < length; i++) { id += alphabet.charAt(Math.floor(Math.random() * alphabet.length)); } return id; };