Skip to content
This repository has been archived by the owner on Mar 2, 2022. It is now read-only.

MasterOdin/yaws-server

Repository files navigation

YAWS-Server

Build Status

Yet Another Web Socket Server

A wrapper around the immensely wonderful websockets/ws that adds some needed utility I find myself always re-implement in usage, such as wrapping JSON messaging with stringify and parse methods, easy broadcasting, etc.

Installation

npm install yaws-server

Usage

const YawsServer = require('yaws-server');
const { createServer } = require('http');

const wsServer = new YawsServer(createServer());
wsServer.on('connection', (client) => {
  client.send('hello', {msg: 'world'});
  client.on('hello', (data) => {
    console.log(data);
  });
});

wsServer.broadcast('hello', {msg: 'world'});

About

Yet Another WebSocket Server

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published