aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2023-09-11 00:42:21 +0700
committerShulhan <ms@kilabit.info>2023-09-11 02:26:33 +0700
commitba9e78e7f0fc026db34d125d187a42e7e4f6e961 (patch)
tree93452613e227211a4a35b81a38ce8a12beefa800 /lib/websocket
parent584b0b372ae0ea69d4fb1f6941c435b9526ddba5 (diff)
downloadpakakeh.go-ba9e78e7f0fc026db34d125d187a42e7e4f6e961.tar.xz
websocket/examples: add missing comments
While at it, realign struct Account to make the size reduced from 32 to 24 bytes (-8).
Diffstat (limited to 'lib/websocket')
-rw-r--r--lib/websocket/examples/account.go4
-rw-r--r--lib/websocket/examples/examples.go3
2 files changed, 5 insertions, 2 deletions
diff --git a/lib/websocket/examples/account.go b/lib/websocket/examples/account.go
index 1f5de70f..fafafd76 100644
--- a/lib/websocket/examples/account.go
+++ b/lib/websocket/examples/account.go
@@ -6,12 +6,12 @@ package examples
// Account represent an example of internal user in the system.
type Account struct {
- ID int64
Name string
Key string // The Key to authenticate user during handshake.
+ ID int64
}
-// List of user's account in the system.
+// Users contain list of user's account in the system.
var Users map[int64]*Account = map[int64]*Account{
1: {
ID: 1,
diff --git a/lib/websocket/examples/examples.go b/lib/websocket/examples/examples.go
index 144adbc5..34c926e7 100644
--- a/lib/websocket/examples/examples.go
+++ b/lib/websocket/examples/examples.go
@@ -2,8 +2,11 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
+// Package examples provide an example on how to use WebSocket server and
+// client.
package examples
+// List of message type broadcasted by server.
const (
BroadcastMessage = "message"
BroadcastSystem = "system"