wsec
Nodejs websocket. Easy and customize-able and fast
install
npm install wsec --save
use
methods 1
will handle only ws
const wsec = ; const options = host: 'localhost' port: 8080 const handler = { // each connection params contain header information and write methods socket; socket; socket;} options handler;
methods 2
Use with your Nodejs HTTP or HTTPS server
const wsec = ; const options = noServer: true; const handler = { // each connection params contain header information and write methods socket; socket; socket;} const ws = options handler const server = http; server;
Client Side
This library need no client side library. You can use native methods in Client side
const socketIns = 'ws://localhost:8080/socket';socketIns { // function will fire when data is received console; socketIns; // send data to server}
Send large file
{ const img = document; img; img { this; }; img;} { const reader = ; reader { this; }; reader;} { socketIns;} ;
Utility
Save identifier for each request
const wsec = ; const options = host: 'localhost' port: 8080 const handler = { socket; socket;} options handler;