Skip to content

WebSockify branch which allows multi instance from single endpoint with support for Express.js

Notifications You must be signed in to change notification settings

sukkamehu/node-multi-websockify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

node-multi-websockify fork of https://github.com/Simplemnt/node-websockify

npm version

Difference of this version to Simplemnt's great work is that this fork adds support also for multiple simultanous WS session to be reached from one port only. Also configuring instance is slightly easier as just single line is required. Should handle also server request upgrading accordingly.

Installation

npm install --save @sukkis/node-multi-websockify

Usage

const websockify = require('@sukkis/node-multi-websockify')
 ...
 ...
websockify(server, [{target: 'localhost:5900', path: '/path1'},{target: 'localhost:5900', path: '/path2'}]) // create websockify servers in array of objects

Express

const express = require('express')
const app = express()
const server = require('http').Server(app)

const port = process.env.PORT || 8080

const websockify = require('@sukkis/node-multi-websockify')

server.listen(port, () =>  console.log('listening on *:' + port))
websockify(server, [{target: 'localhost:5900', path: '/path1'},{target: 'localhost:5900', path: '/path2'}]) // create websockify servers in array of objects

http (untested)

const http = require('http')

const port = process.env.PORT || 8080

const websockify = require('@sukkis/node-multi-websockify')

const server = http.createServer()
server.listen(port)
websockify(server, [{target: 'localhost:5900', path: '/path1'},{target: 'localhost:5900', path: '/path2'}]) // create websockify servers in array of objects

About

WebSockify branch which allows multi instance from single endpoint with support for Express.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published