-
-
Notifications
You must be signed in to change notification settings - Fork 53
Examples
Gerasimos (Makis) Maropoulos edited this page May 28, 2026
·
1 revision
- You want a working example you can copy and run.
- You're not sure which neffos feature to use for your problem.
All examples live at _examples/. Each is self-contained — cd into the directory and go run.
| Example | What it shows |
|---|---|
| basic | Minimal echo server + Go client + browser client. Start here. |
| example | Interactive chat-style demo: connect, join a room, exchange messages, leave. |
| browser | Vanilla browser client paired with a Go server. |
| native-messages | Raw WebSocket frames — no neffos wire format. Useful for interop with non-neffos clients. |
| protobuf | Binary protocol using Protocol Buffers for Message.Body. |
| struct-handler | Methods on a Go struct used as event handlers via neffos.NewStruct. |
| wrap-conns-to-user | Attach a user record to each Conn via Conn.Set("user", u) for auth-aware events. |
| cronjob | Server-side scheduled tasks that broadcast over neffos. |
| scale-out | Multi-instance neffos with Redis and NATS. Pair with [[Scale out |
| stress-test | Synthetic load — server, client, and broadcast variants. |
git clone https://github.com/kataras/neffos
cd neffos/_examples/basic
go run echo.go server # in one terminal
go run echo.go client # in anotherMost server examples bind to :8080. The matching browser examples have a small index.html you can open after starting the server.
Browser and Node samples for the neffos.js TypeScript client live in neffos.js/_examples.
- Getting started — the canonical echo walkthrough
-
Struct handlers — when to use
NewStructinstead ofEvents -
Scale out — clustering pairs with the
scale-outexample - Reconnection — the auto-reconnect feature exercised in the browser examples
Home | About | Project | Getting Started | Technical Docs | Copyright © 2019-2023 Gerasimos Maropoulos. Documentation terms of use.
Getting started
Concepts
Messaging
Production
Scale out