From b0c9c5ec18a8c61acb2b92af2a90199d07406546 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 25 May 2018 13:02:50 -0700 Subject: [PATCH] Connect to a certain game instead of index. --- Go.elm | 2 +- Go/Ws.elm | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Go.elm b/Go.elm index 71bea75..a3a45a4 100644 --- a/Go.elm +++ b/Go.elm @@ -44,6 +44,6 @@ update msg model = case msg of subscriptions : Model -> Sub Msg subscriptions m = - WebSocket.listen m.sessionUrl Update + WebSocket.listen (wsUrl m) Update main = Html.programWithFlags { init = init, update = update, subscriptions = subscriptions, view = view } diff --git a/Go/Ws.elm b/Go/Ws.elm index 480cae5..403d66b 100644 --- a/Go/Ws.elm +++ b/Go/Ws.elm @@ -2,6 +2,9 @@ module Go.Ws exposing (..) import Go.Types exposing (..) import WebSocket +wsUrl : Model -> String +wsUrl m = (m.sessionUrl ++ "/game/" ++ (toString m.sessionId)) + encodeCell : Cell -> String encodeCell ((x, y), c) = "place " ++ (toString x) ++ " " @@ -9,4 +12,4 @@ encodeCell ((x, y), c) = "place " ++ (toString c) sendMove : Model -> Cell -> Cmd Msg -sendMove m c = WebSocket.send m.sessionUrl (encodeCell c) +sendMove m c = WebSocket.send (wsUrl m) (encodeCell c)