diff options
author | Martin Kraft <martinkraft@gmail.com> | 2018-05-17 07:53:16 -0400 |
---|---|---|
committer | Martin Kraft <martinkraft@gmail.com> | 2018-05-17 07:53:16 -0400 |
commit | 6f31d90e2f31ae597b83b2f845d5db938af8e38c (patch) | |
tree | 81c59b83ffb033df92ff7fba5ffaf3ba5fe7a3cf /api/websocket.go | |
parent | 319d61123a0418ea9caa9510b8ad1e9a302c7b93 (diff) | |
parent | 1f6c271b3bedd6656ae7155714423b1b39a669c1 (diff) | |
download | chat-6f31d90e2f31ae597b83b2f845d5db938af8e38c.tar.gz chat-6f31d90e2f31ae597b83b2f845d5db938af8e38c.tar.bz2 chat-6f31d90e2f31ae597b83b2f845d5db938af8e38c.zip |
Merge remote-tracking branch 'origin/master' into advanced-permissions-phase-2
Diffstat (limited to 'api/websocket.go')
-rw-r--r-- | api/websocket.go | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/api/websocket.go b/api/websocket.go deleted file mode 100644 index 7f2c9c0db..000000000 --- a/api/websocket.go +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. -// See License.txt for license information. - -package api - -import ( - "fmt" - "net/http" - - "github.com/gorilla/websocket" - "github.com/mattermost/mattermost-server/mlog" - "github.com/mattermost/mattermost-server/model" -) - -func (api *API) InitWebSocket() { - api.BaseRoutes.Users.Handle("/websocket", api.ApiAppHandlerTrustRequester(connect)).Methods("GET") -} - -func connect(c *Context, w http.ResponseWriter, r *http.Request) { - upgrader := websocket.Upgrader{ - ReadBufferSize: model.SOCKET_MAX_MESSAGE_SIZE_KB, - WriteBufferSize: model.SOCKET_MAX_MESSAGE_SIZE_KB, - CheckOrigin: c.App.OriginChecker(), - } - - ws, err := upgrader.Upgrade(w, r, nil) - if err != nil { - mlog.Error(fmt.Sprintf("websocket connect err: %v", err)) - c.Err = model.NewAppError("connect", "api.web_socket.connect.upgrade.app_error", nil, "", http.StatusInternalServerError) - return - } - - wc := c.App.NewWebConn(ws, c.Session, c.T, c.Locale) - - if len(c.Session.UserId) > 0 { - c.App.HubRegister(wc) - } - - wc.Pump() -} |