blacksocket.io
A websocket wrapper. Basically compatiable with socket.io.
- Lightweight
- Callback
- Auto reconnection
- Object sending
- Binary sending (even in object) (even in callback)
- Once
- Promise
Install
Server
npm i -S blacksocket.io
Client
Install with npm
npm i -S blacksocket.io
Use script file directly
Just for testing
Usage
I have no time for writing a whole documentation for it. If you want to use it, I personally recommend you to read the test/test.js file to get all the demos.
Server
// initialize with port and pathconst io = 23033 path: "/test";io;
Client (nodejs or browser)
const io = ;// initialize with port and pathconst socket = ; // first-connect: triggered on first connection// connect: triggered on every successful connection(including reconnection)// reconnection event: triggered on reconnectionsocket; socket;
Try it with docker
docker run -it --rm -p 23034:80 -p 23033:23033 blackmiaool/blacksocket.io
Open the website
About document
- <Refactoring JavaScript Turning Bad Code Into Good Code>