Getting Started
This guide walks you through installing Konet and running your first channel subscription.
Prerequisites
- Docker & Docker Compose
- (Optional) Go 1.25+ if building the CLI from source
1. Install the CLI
macOS / Linux
brew install raucheacho/tap/konetFrom source
git clone https://github.com/raucheacho/konet.git
cd konet/konet-cli
go build -o konet .
mv konet /usr/local/bin/Verify:
konet --version2. Initialize
konet initThis creates a konet.config.toml in the current directory. Open it and set a
strong jwt_secret, then generate your keys:
konet keys generateThis writes an anon_key (safe for clients) and a service_key (server-side
only) back into konet.config.toml.
3. Start the server
konet startThe first start pulls ghcr.io/raucheacho/konet:latest and boots the container.
Later starts reuse the cached image.
4. Verify
konet statusYou should see the server as running.
5. Connect with an SDK
Use the anon_key from konet.config.toml as the token below.
JavaScript
npm install @raucheacho/konet-jsimport { createClient } from '@raucheacho/konet-js'
const client = createClient('ws://localhost:4000/socket', {
token: '<anon_key>',
})
const channel = client.channel('room:lobby')
await channel.subscribe()
channel.on('message', (payload) => console.log(payload))
channel.send('message', { text: 'Hello Konet!' })Python
pip install konetimport asyncio
from konet import KonetClient
async def main():
async with KonetClient('ws://localhost:4000/socket', token='<anon_key>') as client:
channel = client.channel('room:lobby')
await channel.subscribe()
channel.on('message', lambda payload: print(payload))
await channel.send('message', {'text': 'Hello Konet!'})
await asyncio.sleep(60)
asyncio.run(main())Go
package main
import (
"context"
"log"
konet "github.com/raucheacho/konet/sdk/go"
)
func main() {
ctx := context.Background()
client := konet.New("ws://localhost:4000/socket", "<anon_key>")
if err := client.Connect(ctx); err != nil {
log.Fatal(err)
}
defer client.Disconnect()
ch := client.Channel("room:lobby")
if err := ch.Subscribe(ctx); err != nil {
log.Fatal(err)
}
ch.On("message", func(p interface{}) {
log.Println(p)
})
ch.Send("message", map[string]any{"text": "Hello Konet!"})
select {} // block
}React Native
npm install @raucheacho/konet-js @raucheacho/konet-rnimport { createNativeClient } from '@raucheacho/konet-rn'
const client = createNativeClient('ws://localhost:4000/socket', {
token: '<anon_key>',
})
const channel = client.channel('room:lobby')
await channel.subscribe()
channel.on('message', (payload) => console.log(payload))
channel.send('message', { text: 'Hello Konet!' })Same API as the JavaScript SDK, plus automatic reconnection when the app returns to the foreground — see React Native.
On a physical device, localhost is the phone, not your machine: use your
machine's LAN address (ws://192.168.x.x:4000/socket).
6. Watch it happen
Open the Studio and go to Logs to see joins, leaves, and broadcasts stream in as your client connects:
konet studioNext Steps
- Run the Live Room example — cursors, presence, and chat in a few minutes
- Learn about Server configuration
- Deploy to a VPS, Coolify, or Dokploy
- Explore CLI commands
- Read the API reference