diff options
author | stuebinm | 2024-05-15 01:51:32 +0200 |
---|---|---|
committer | stuebinm | 2024-05-15 01:56:55 +0200 |
commit | de81d9444c4252e87fa61eee53f439a352531e41 (patch) | |
tree | 878f32aa992d42ca02418caa36826ae43ae08894 /lib/Server/Frontend | |
parent | f2fd4980a53b2c321b605167ae240a430bef852c (diff) |
Frontend.Tickets,Server.Ingest: fix map view
this is really two changes:
- some leftover lat,long keys in the clientside javascript
- the Server.Subscribe module should send a correct ping after a
connection has been opened
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+")"; } |] |