Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.
Gentilhomme edited this page Aug 28, 2017 · 3 revisions

Server

µWebSockets Server interface

Properties

name type
id String
sockets Map
wss original µWebSockets Server

the property id is a random generated id with the library npm 'uuid'

Events

connection -> socket

disconnect -> socket

error -> errorMessage

const uVyper = require('uvyper');

const IO = new uVyper.Server({port: 3000});
IO.on('connection',function(socket) {
    console.log(`Socket ${socket.id} connected!`);
});

IO.on('disconnect',function(socket) {
    console.log(`Socket ${socket.id} disconnect!`);
});

IO.on('error',function(error) {
    throw error;
});
console.log('WebSocket server started!');

Clone this wiki locally