Performant WebSocket server and persistent client powered by uWebSockets.js and PersistentWebSocket
npm i @geut/socketich
- Start server
// Node app
import { createServer } from '@geut/socketich'
const stop = createServer({ port, host })
// Gracefully shut down server:
stop()
// WS Server listeninig on ws://0.0.0.0:3000
- Create and connect a Socketich client
// Browser/Client app
await import('http://0.0.0.0:3000/client.min.js?format=iife')
client = new Client('ws://0.0.0.0:3000', Date.now())
await client.connected
room = client.createRoom('chat-with-socketich')
room.on('chat-message', message => console.log('New message:', message))
room.emit('chat-message', 'Hello there!')
🐛 If you found an issue we encourage you to report it on github. Please specify your OS and the actions to reproduce it.
👥 Ideas and contributions to the project are welcome. You must follow this guideline.
MIT © A GEUT project