aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/connection.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/src/js/connection.js')
-rw-r--r--web/src/js/connection.js29
1 files changed, 0 insertions, 29 deletions
diff --git a/web/src/js/connection.js b/web/src/js/connection.js
deleted file mode 100644
index 5e229b6e..00000000
--- a/web/src/js/connection.js
+++ /dev/null
@@ -1,29 +0,0 @@
-
-var actions = require("./actions.js");
-var AppDispatcher = require("./dispatcher.js").AppDispatcher;
-
-function Connection(url) {
- if (url[0] === "/") {
- url = location.origin.replace("http", "ws") + url;
- }
-
- var ws = new WebSocket(url);
- ws.onopen = function () {
- actions.ConnectionActions.open();
- };
- ws.onmessage = function (message) {
- var m = JSON.parse(message.data);
- AppDispatcher.dispatchServerAction(m);
- };
- ws.onerror = function () {
- actions.ConnectionActions.error();
- actions.EventLogActions.add_event("WebSocket connection error.");
- };
- ws.onclose = function () {
- actions.ConnectionActions.close();
- actions.EventLogActions.add_event("WebSocket connection closed.");
- };
- return ws;
-}
-
-module.exports = Connection; \ No newline at end of file