From 1eb7136d27ecd557b92b01d8f993fc5b05d73b62 Mon Sep 17 00:00:00 2001 From: Nicholas Kariniemi Date: Fri, 1 May 2015 08:46:02 +0300 Subject: [PATCH] Use relative paths for websocket connection --- src/cljs/grub/websocket.cljs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/cljs/grub/websocket.cljs b/src/cljs/grub/websocket.cljs index 373e897..cf67309 100644 --- a/src/cljs/grub/websocket.cljs +++ b/src/cljs/grub/websocket.cljs @@ -7,10 +7,12 @@ (:require-macros [cljs.core.async.macros :refer [go go-loop]] [grub.macros :refer [log logs]])) -(def protocol (.-protocol (.-location js/document))) +(def location (.-location js/document)) +(def protocol (.-protocol location)) (def ws-protocol (if (= protocol "http:") "ws://" "wss://")) -(def host (.-host (.-location js/document))) -(def server-url (str ws-protocol host)) +(def host (.-host location)) +(def path (.-pathname location)) +(def server-url (str ws-protocol host path)) (def reader (t/reader :json)) (def writer (t/writer :json))