The Socket Optimizer
Simplify and optimize socket communication with multiplexing, congestion control, and support for all major protocols. Works seamlessly in browser and Node.js.
// Server
const Kalm = require('kalm');
const ws = require('@kalm/ws');
const server = Kalm.listen({
port: 9001,
transport: ws(),
});
server.on('connection', (client) => {
client.subscribe('chat', (data) => {
// Broadcast to all clients
server.broadcast('chat', data);
});
});
// Client
const client = Kalm.connect({
host: '0.0.0.0',
port: 9001,
transport: ws(),
});
client.on('connect', () => {
client.subscribe('chat', (data) => {
console.log(data.user + ': ' + data.message);
});
client.write('chat', {
user: 'User',
message: 'Hello World!',
});
});
Handle multiple channels over a single connection
Smart throttling and backpressure handling
Works with TCP, UDP, WebSocket, IPC
Same API for browser and Node.js
Messages are delivered in real-time and are not stored. This is a live demo showcasing Kalm's WebSocket capabilities.