A minimal real-time chat built with Bnlang, RouteOn, and bnlang-web-socket. UI uses Tailwind (via CDN).
- Start a chat from the homepage
- Share the
/chat/1link to chat in real time - No REST endpoints; rooms are handled purely via WebSocket
- Tailwind CSS via CDN, no build step
- In-memory/ephemeral state
- Bnlang v1.0.0+ recommended
- BNLang runtime CLI available on
PATH(thebnlcommand)
bpm install
bpm run start
- HTTP server:
http://localhost:3000 - WebSocket server:
ws://127.0.0.1:8080/ws
- Open
http://localhost:3000/ - Enter your display name and click "Start Chat"
- You will be redirected to
/chat/1 - Open the same URL in another browser/device to chat in real time
- State is in-memory; restarting the server clears connections and messages.
- Tailwind is loaded via CDN in templates; no local CSS build required.
- URL:
ws://127.0.0.1:8080/ws - Client joins a room after connect:
{ "type": "join", "roomId": "1", "name": "<displayName>" } - Client sends a message:
{ "type": "message", "roomId": "1", "text": "Hello" } - Server broadcasts to all peers in the room:
- Chat:
{ type: "message", roomId, name, text, ts } - System:
{ type: "system", roomId, text, ts }
- Chat:
index.bnl— HTTP server and routeschat.bnl— WebSocket server and room broadcastingviews/— BHTML templates (index.bhtml,chat.bhtml)public/— static assets (served at/)