The Socket Optimizer
- Easy-to-use syntax unified across protocols
- Flexible and extensible, load your own transports and routines
- Can be used between servers or in the browser
- Lower resource footprint and better throughtput than plain sockets
- Zero dependencies and can be bundled down to ~5kb!
The performance gain comes from buffering packets before sending them- eventually sending batches instead of individual packages. The more traffic getting processed, the better the improvement. Many strategies are offered as routines. You can read more about the packet buffering algorithm here
Install the core package
npm install kalm
Install the transport layer ('tcp' for example)
npm install @kalm/tcp
const kalm = ;const ws = ;const server = kalm;server;
const kalm = ;const ws = ;const client = kalm;client;
To see working implementations, check out our examples folder.
- Transports [wiki]
- Routines [wiki]
Kalm uses the
NODE_DEBUG environment variable. Just include
kalm in your value.
NODE_DEBUG=net,kalm node myApp.js
Kalm offers events to track when packets are processed by routines or when a raw frame is received.
||Error||(provider, client) Emits on errors.|
||void||(provider) Indicates that the provider is now actively listeneing for new connections|
||Client||(provider) Indicates that a client has successfuly connected|
||Client||(client) Indicates that a client has successfuly connected|
||void||(client) Indicates that a client has disconnected|
||RawFrame||(client) Triggered when recieving a parsed full frame.|
||(client) Indicates that a packet was queued to a frame.|
||(client) Indicates that a frame is being sent.|
npm run bench
If you think of something that you want, open an issue or file a pull request, we'll be more than happy to take a look!
This project exists thanks to all the people who contribute. [Contribute].
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]
Apache 2.0 (c) 2020 Frederic Charette