package examples
import "git.sr.ht/~shulhan/pakakeh.go/lib/websocket/examples"
Package examples provide an example on how to use WebSocket server and client.
Index ¶
Constants ¶
const ( BroadcastMessage = "message" BroadcastSystem = "system" )
List of message type broadcasted by server.
Variables ¶
var Users = map[int64]*Account{ 1: { ID: 1, Name: "Groot", Key: "iamgroot", }, 2: { ID: 2, Name: "Thanos", Key: "thanosdidnothingwrong", }, 3: { ID: 3, Name: "Hulk", Key: "arrrr", }, 4: { ID: 4, Name: `Ironman`, Key: `pewpew`, }, }
Users contain list of user's account in the system.
Types ¶
type Account ¶
type Account struct { Name string Key string // The Key to authenticate user during handshake. ID int64 }
Account represent an example of internal user in the system.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
lib/websocket/examples/cmd | |
lib/websocket/examples/cmd/client | Program client provide an example of chat client that connect to WebSocket server. |
lib/websocket/examples/cmd/server | Program server provide an example of WebSocket server as group chat. |
- Version
- v0.60.0 (latest)
- Published
- Feb 1, 2025
- Platform
- linux/amd64
- Last checked
- 25 minutes ago –
Tools for package owners.