diff options
Diffstat (limited to 'lib/Server/Frontend')
-rw-r--r-- | lib/Server/Frontend/Tickets.hs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Server/Frontend/Tickets.hs b/lib/Server/Frontend/Tickets.hs index ef80d42..3e17cd1 100644 --- a/lib/Server/Frontend/Tickets.hs +++ b/lib/Server/Frontend/Tickets.hs @@ -292,20 +292,21 @@ getTicketMapViewR ticketId = do attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors' }).addTo(map); - ws = new WebSocket((location.protocol == "http:" ? "ws" : "wss") + "://" + location.host + "/api/train/subscribe/#{UUID.toText ticketId}"); + ws = new WebSocket((location.protocol == "http:" ? "ws" : "wss") + "://" + location.host + "/api/ticket/subscribe/#{UUID.toText ticketId}"); var marker = null; ws.onmessage = (msg) => { let json = JSON.parse(msg.data); + console.log(json) if (marker === null) { - marker = L.marker([json.lat, json.long]); + marker = L.marker(json.geopos); marker.addTo(map); } else { - marker.setLatLng([json.lat, json.long]); + marker.setLatLng(json.geopos); } - map.setView([json.lat, json.long], 13); - document.getElementById("status").innerText = "_{MsgLastPing}: "+json.lat+","+json.long+" ("+json.timestamp+")"; + map.setView(json.geopos, 13); + document.getElementById("status").innerText = "_{MsgLastPing}: "+json.geopos[0]+","+json.geopos[1]+" ("+json.timestamp+")"; } |] |