GoUI/Go/Ws.elm

16 lines
380 B
Elm
Raw Permalink Normal View History

module Go.Ws exposing (..)
import Go.Types exposing (..)
import WebSocket
wsUrl : Model -> String
wsUrl m = (m.sessionUrl ++ "/game/" ++ m.sessionId)
encodeCell : Cell -> String
encodeCell ((x, y), c) = "place "
++ (toString x) ++ " "
++ (toString y) ++ " "
++ (toString c)
sendMove : Model -> Cell -> Cmd Msg
sendMove m c = WebSocket.send (wsUrl m) (encodeCell c)