diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-08-11 16:07:22 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-08-11 16:07:22 +0700 |
| commit | 7a6afab5cbd0a02402309fed0ff021d6f9143427 (patch) | |
| tree | 2c27ea6e0e728e9213ca4a5ae57ac5ddfb0ea1c5 /lib/websocket/examples | |
| parent | 909a6c722d7ed69976a171fcb6560b179477227a (diff) | |
| download | pakakeh.go-7a6afab5cbd0a02402309fed0ff021d6f9143427.tar.xz | |
websocket: move the server handler to ServerOptions
Diffstat (limited to 'lib/websocket/examples')
| -rw-r--r-- | lib/websocket/examples/cmd/server/main.go | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/websocket/examples/cmd/server/main.go b/lib/websocket/examples/cmd/server/main.go index ad593c36..2258718f 100644 --- a/lib/websocket/examples/cmd/server/main.go +++ b/lib/websocket/examples/cmd/server/main.go @@ -25,16 +25,14 @@ func main() { opts := &websocket.ServerOptions{ Address: ":9001", + // Register the authentication handler. + HandleAuth: handleAuth, + HandleClientAdd: handleClientAdd, + HandleClientRemove: handleClientRemove, } server = websocket.NewServer(opts) - // Register the authentication handler. - server.HandleAuth = handleAuth - - server.HandleClientAdd = handleClientAdd - server.HandleClientRemove = handleClientRemove - // Register the message handler err := server.RegisterTextHandler(http.MethodPost, "/message", handlePostMessage) if err != nil { |
