From 072411a304c7d8229d9c89db01d8974a85dd9853 Mon Sep 17 00:00:00 2001 From: meeki007 <5952964+meeki007@users.noreply.github.com> Date: Mon, 31 Jul 2023 04:34:09 -0400 Subject: [PATCH 1/2] Update worldmap.js - add clientTimezone (#245) Add clientTimezone to the 'connected' msg.payload If unable to complete query return bool of 'false' Why? Many clients connect to the world map from different locals. Knowing what time their browser/computer is using allows us to format events to their timezone. Overhead is minimal as it only is queried once when they connect. --- worldmap/worldmap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/worldmap/worldmap.js b/worldmap/worldmap.js index fa6bf6f..7dbd994 100644 --- a/worldmap/worldmap.js +++ b/worldmap/worldmap.js @@ -63,7 +63,7 @@ var connect = function() { if (!inIframe) { document.getElementById("footer").innerHTML = ""+pagefoot+""; } - ws.send(JSON.stringify({action:"connected",parameters:Object.fromEntries((new URL(location)).searchParams)})); + ws.send(JSON.stringify({action:"connected",parameters:Object.fromEntries((new URL(location)).searchParams),clientTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone || false})); onoffline(); }; ws.onclose = function() { From 73b1347ec3438c78e53b27b402f438c8046fe1d4 Mon Sep 17 00:00:00 2001 From: meeki007 <5952964+meeki007@users.noreply.github.com> Date: Mon, 31 Jul 2023 04:34:20 -0400 Subject: [PATCH 2/2] Update README.md - clientTimezone (#246) Document the function of msg.payload.clientTimezone Also added documentation for msg.payload.parameters --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 32b23ee..a682559 100644 --- a/README.md +++ b/README.md @@ -363,7 +363,10 @@ All actions also include a: `msg._sessionid` property that indicates which client session they came from. Any msg sent out that includes this property will ONLY be sent to that session - so you can target map updates to specific sessions if required. `msg._sessionip` property that shows the ip of the client that is connected to the session. -The "connected" action also include a `msg._clientheaders` property that shows the headers sent by the client to make a connection to the session. +The "connected" action additionally includes a: +`msg.payload.parameters` property object that lists the parameters sent in the url. +`msg.payload.clientTimezone` property string showing the clients local Timezone. Returns bool of `false` if unable to retrive clients local Timezone. +`msg._clientheaders` property that shows the headers sent by the client to make a connection to the session. ### Utility functions