@@ -768,7 +768,9 @@ const parseUserAgentHeader = (userAgent) => {
768768 * - "clients_list" the whole registry (the dashboard renders it)
769769 * - "client_log" a single log line (a monitor appends it)
770770 * - "client_activity" a single qualified activity (a monitor appends it)
771- * - "client_here" a client just appeared/resumed (every page can toast it)
771+ * - "client_here" a networked client just appeared/resumed (every page
772+ * can toast it); never sent for the main client, which
773+ * is the person reading the toast
772774 * - "client_command" pilot one client (navigate/reload its tab) from the
773775 * dashboard; the matching reporter runs it
774776 * Server events are broadcast, so consumers filter what they care about.
@@ -783,7 +785,7 @@ const parseUserAgentHeader = (userAgent) => {
783785 *
784786 * The monitoring script is injected into EVERY cooked page, including our own
785787 * dashboard and monitor pages — so opening one of those counts as a connected
786- * client, and any open page gets toasted when another client appears.
788+ * client, and any open page gets toasted when another networked client appears.
787789 *
788790 * Pages:
789791 * - /.internal/clients → dashboard listing every client seen
@@ -1114,12 +1116,25 @@ const jsenvPluginClientMonitoring = () => {
11141116 pruneTabs ( client ) ;
11151117 pruneClients ( ) ;
11161118
1117- if ( firstEver ) {
1118- sendClientHere ( { reason : "new" , client : serializeClient ( client ) } ) ;
1119- sendClientsList ( ) ;
1120- } else if ( ! wasOnline ) {
1121- // A report after a long quiet spell means the client was picked back up.
1122- sendClientHere ( { reason : "resumed" , client : serializeClient ( client ) } ) ;
1119+ if ( firstEver || ! wasOnline ) {
1120+ // The toast invites the reader to monitor the client that just appeared,
1121+ // so it is only worth showing for a client there is something to watch:
1122+ // one reaching the server over the network. The machine running the dev
1123+ // server is the person reading the toast — it browses over localhost, its
1124+ // devtools are one keystroke away and nothing is captured for it, so
1125+ // announcing it means interrupting someone about themselves. It happens
1126+ // more than one would think: the client id lives in localStorage, so the
1127+ // same browser gets a fresh id per origin (localhost vs 127.0.0.1 vs the
1128+ // LAN ip, another port) and in private windows, and each of those looks
1129+ // like a brand new client to the server.
1130+ if ( ! isLocalIp ( client . ip ) ) {
1131+ sendClientHere ( {
1132+ // A report after a long quiet spell means the client was picked back
1133+ // up rather than newly seen.
1134+ reason : firstEver ? "new" : "resumed" ,
1135+ client : serializeClient ( client ) ,
1136+ } ) ;
1137+ }
11231138 sendClientsList ( ) ;
11241139 }
11251140
0 commit comments