get websocket scheme from window.location.protocol

This commit is contained in:
Thomas Steen Rasmussen 2019-01-22 09:01:53 +01:00
parent d38453c745
commit 58d670b57f

View file

@ -30,13 +30,14 @@
<script> <script>
var container = document.getElementById('schedule-container'); var container = document.getElementById('schedule-container');
var ws_scheme = window.location.protocol == "https:" ? "wss" : "ws";
var elm_app = Elm.Main.embed( var elm_app = Elm.Main.embed(
container, container,
{ 'schedule_timeslot_length_minutes': Number('{{ schedule_timeslot_length_minutes }}') { 'schedule_timeslot_length_minutes': Number('{{ schedule_timeslot_length_minutes }}')
, 'schedule_midnight_offset_hours': Number('{{ schedule_midnight_offset_hours }}') , 'schedule_midnight_offset_hours': Number('{{ schedule_midnight_offset_hours }}')
, 'ics_button_href': "{% url 'program:ics_view' camp_slug=camp.slug %}" , 'ics_button_href': "{% url 'program:ics_view' camp_slug=camp.slug %}"
, 'camp_slug': "{{ camp.slug }}" , 'camp_slug': "{{ camp.slug }}"
, 'websocket_server': "wss://" + window.location.host + "/schedule/" , 'websocket_server': ws_scheme + "://" + window.location.host + "/schedule/"
} }
); );
</script> </script>