aboutsummaryrefslogtreecommitdiff
path: root/lib/websocket/examples/cmd
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2020-08-11 16:36:45 +0700
committerShulhan <m.shulhan@gmail.com>2020-08-11 16:36:45 +0700
commit07e8370f158addf23591caa4e268e0fdd0992b44 (patch)
treefad1cca37969f6c0aa01811d8fdf4c4a5b96e349 /lib/websocket/examples/cmd
parent7a6afab5cbd0a02402309fed0ff021d6f9143427 (diff)
downloadpakakeh.go-07e8370f158addf23591caa4e268e0fdd0992b44.tar.xz
websocket: reformat some files
Diffstat (limited to 'lib/websocket/examples/cmd')
-rw-r--r--lib/websocket/examples/cmd/server/main.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/websocket/examples/cmd/server/main.go b/lib/websocket/examples/cmd/server/main.go
index 2258718f..4bf771fc 100644
--- a/lib/websocket/examples/cmd/server/main.go
+++ b/lib/websocket/examples/cmd/server/main.go
@@ -34,7 +34,8 @@ func main() {
server = websocket.NewServer(opts)
// Register the message handler
- err := server.RegisterTextHandler(http.MethodPost, "/message", handlePostMessage)
+ err := server.RegisterTextHandler(http.MethodPost, "/message",
+ handlePostMessage)
if err != nil {
log.Fatal(err)
}
@@ -120,7 +121,9 @@ func handleClientRemove(ctx context.Context, conn int) {
//
// handlePostMessage handle message that is send to server by client.
//
-func handlePostMessage(ctx context.Context, req *websocket.Request) (res websocket.Response) {
+func handlePostMessage(ctx context.Context, req *websocket.Request) (
+ res websocket.Response,
+) {
uid := ctx.Value(websocket.CtxKeyUID).(int64)
user := examples.Users[uid]