From de81d9444c4252e87fa61eee53f439a352531e41 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 15 May 2024 01:51:32 +0200 Subject: 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 --- lib/Server/Frontend/Tickets.hs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/Server/Frontend') 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: '© OpenStreetMap 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+")"; } |] -- cgit v1.2.3