learn-co/single-socket

Name: single-socket

Owner: Learn.co

Description: Share a single websocket across Node processes

Created: 2016-08-19 00:11:56.0

Updated: 2016-08-20 00:37:49.0

Pushed: 2016-11-09 16:37:15.0

Homepage: null

Size: 105

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

SingleSocket

Note: This project is experimental for now and still under active development

Share a single websocket connection across Node processes.

How It Works

SingleSocket uses a local socket (via node-ipc) to route clients through a single websocket connection.

Install

npm install single-socket --save

Usage
t SingleSocket = require('single-socket')

client = new SingleSocket('ws://echo.websocket.org')


nt.on('error', (err) => {
nsole.error(err)


nt.on('open', () => {
nsole.log('Client Connected')


nt.on('close', () => {
nsole.log('Client Closed')


nt.on('message', (msg) => {
nsole.log(msg)


nt.send('hello world')

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.