Skip to content

Websockets

michaelSaunders edited this page Mar 11, 2018 · 6 revisions

Websocket notes

Connecting to the server client side

       $(function () {
            // Correctly decide between ws:// and wss://
            var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
            var ws_path = ws_scheme + '://' + window.location.host + "/chat/stream/";
            console.log("Connecting to " + ws_path);
            var socket = new ReconnectingWebSocket(ws_path);

Clone this wiki locally