summaryrefslogtreecommitdiffstats
path: root/wsapi/system.go
diff options
context:
space:
mode:
Diffstat (limited to 'wsapi/system.go')
-rw-r--r--wsapi/system.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/wsapi/system.go b/wsapi/system.go
new file mode 100644
index 000000000..644d0196f
--- /dev/null
+++ b/wsapi/system.go
@@ -0,0 +1,27 @@
+// Copyright (c) 2017 Mattermost, Inc. All Rights Reserved.
+// See License.txt for license information.
+
+package wsapi
+
+import (
+ l4g "github.com/alecthomas/log4go"
+ "github.com/mattermost/platform/app"
+ "github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
+)
+
+func InitSystem() {
+ l4g.Debug(utils.T("wsapi.system.init.debug"))
+
+ app.Srv.WebSocketRouter.Handle("ping", ApiWebSocketHandler(ping))
+}
+
+func ping(req *model.WebSocketRequest) (map[string]interface{}, *model.AppError) {
+ data := map[string]interface{}{}
+ data["text"] = "pong"
+ data["version"] = model.CurrentVersion
+ data["server_time"] = model.GetMillis()
+ data["node_id"] = ""
+
+ return data, nil
+}