diff options
Diffstat (limited to 'api/websocket.go')
-rw-r--r-- | api/websocket.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/api/websocket.go b/api/websocket.go index fe9fa0bf9..34d95f705 100644 --- a/api/websocket.go +++ b/api/websocket.go @@ -11,16 +11,20 @@ import ( "net/http" ) +const ( + SOCKET_MAX_MESSAGE_SIZE_KB = 8 * 1024 // 8KB +) + func InitWebSocket() { l4g.Debug(utils.T("api.web_socket.init.debug")) BaseRoutes.Users.Handle("/websocket", ApiUserRequiredTrustRequester(connect)).Methods("GET") - hub.Start() + HubStart() } func connect(c *Context, w http.ResponseWriter, r *http.Request) { upgrader := websocket.Upgrader{ - ReadBufferSize: 1024, - WriteBufferSize: 1024, + ReadBufferSize: SOCKET_MAX_MESSAGE_SIZE_KB, + WriteBufferSize: SOCKET_MAX_MESSAGE_SIZE_KB, CheckOrigin: func(r *http.Request) bool { return true }, @@ -34,7 +38,7 @@ func connect(c *Context, w http.ResponseWriter, r *http.Request) { } wc := NewWebConn(c, ws) - hub.Register(wc) + HubRegister(wc) go wc.writePump() wc.readPump() } |