Fixing websocket url.
This commit is contained in:
parent
e103cb57b5
commit
7abd35ab66
|
@ -6,7 +6,7 @@ import Models exposing (..)
|
|||
import Routing exposing (parseLocation)
|
||||
import Update exposing (update)
|
||||
import Messages exposing (Msg(..))
|
||||
import WebSocketCalls exposing (scheduleServer, sendInitMessage)
|
||||
import WebSocketCalls exposing (sendInitMessage)
|
||||
import Views exposing (view)
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ init flags location =
|
|||
initModel =
|
||||
Model [] [] [] [] [] flags emptyFilter currentRoute
|
||||
in
|
||||
initModel ! [ sendInitMessage flags.camp_slug ]
|
||||
initModel ! [ sendInitMessage flags.camp_slug flags.websocket_server ]
|
||||
|
||||
|
||||
|
||||
|
@ -49,4 +49,4 @@ init flags location =
|
|||
|
||||
subscriptions : Model -> Sub Msg
|
||||
subscriptions model =
|
||||
WebSocket.listen scheduleServer WebSocketPayload
|
||||
WebSocket.listen model.flags.websocket_server WebSocketPayload
|
||||
|
|
|
@ -98,4 +98,5 @@ type alias Flags =
|
|||
, schedule_midnight_offset_hours : Int
|
||||
, ics_button_href : String
|
||||
, camp_slug : String
|
||||
, websocket_server : String
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module WebSocketCalls exposing (scheduleServer, sendInitMessage)
|
||||
module WebSocketCalls exposing (sendInitMessage)
|
||||
|
||||
-- Internal modules
|
||||
|
||||
|
@ -11,13 +11,8 @@ import WebSocket
|
|||
import Json.Encode
|
||||
|
||||
|
||||
scheduleServer : String
|
||||
scheduleServer =
|
||||
"ws://localhost:8000/schedule/"
|
||||
|
||||
|
||||
sendInitMessage : String -> Cmd Msg
|
||||
sendInitMessage camp_slug =
|
||||
sendInitMessage : String -> String -> Cmd Msg
|
||||
sendInitMessage camp_slug scheduleServer =
|
||||
WebSocket.send scheduleServer
|
||||
(Json.Encode.encode 0
|
||||
(Json.Encode.object
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -17,6 +17,7 @@ var elm_app = Elm.Main.embed(
|
|||
, 'schedule_midnight_offset_hours': Number('{{ schedule_midnight_offset_hours }}')
|
||||
, 'ics_button_href': "{% url 'ics_view' camp_slug=camp.slug %}"
|
||||
, 'camp_slug': "{{ camp.slug }}"
|
||||
, 'websocket_server': "ws://" + window.location.host + "/schedule/"
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue