Skip to content

Yonle/websockify.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

websockify.js

A websockify written in javascript, But with 2 Converting Method.

API

module.tcp

A function that convert TCP into WS. There's a required parameter's:

  • target[Object] A TCP Server target to convert to
  • forwardTo[Object] A websocket new WebSocket(....).

Example

const { tcp } = require('websockify.js');

tcp({
	hostname: 'localhost',
	port: 8080
}, { port: 9090 });
// Now forwarding tcp://localhost:8080 to ws://localhost:9090

module.ws

A function that convert WS into TCP. There's a required parameter's:

  • target[String] A Websocket Server target to convert to
  • forwardToPort[Number/String] Forward to port?
  • forwardToHostname[String] Forward to hostname?

Example

const { ws } = require('websockify.js');

ws('ws://localhost:8080', 9090, 'localhost');
// Now forwarding ws://localhost:8080 to tcp://localhost:9090

Community

About

A websockify written in javascript, But with 2 Converting Method.

Topics

Resources

License

Stars

Watchers

Forks