# Notification Shows on Multiple Sessions

**URL:** https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126
**Category:** Dashboard
**Created:** [10 July 2019 19:26 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126 "2019-07-10T19:26:27Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [10 July 2019 19:26 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/1 "2019-07-10T19:26:27Z")

</div>

I noticed that when I generate a Notification popup on one web/session instance, it shows up on other web/sessions on another PC.

I thought there was a way to localize it, but could not find anything.

Any suggestions?

Thanks...

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [10 July 2019 19:43 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/2 "2019-07-10T19:43:23Z")

</div>

You need to give a lot more context. We have no idea how you are generating popups nor against what ui (admin, dashbord, ...)

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [10 July 2019 19:56 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/3 "2019-07-10T19:56:17Z")

</div>

Sure, the **ui\_notification** widget in the dashboard. Basically when it gets fired, the notification will appear on all connected PC to the NR server instead of the one that triggered it (Basically a button press).

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [10 July 2019 20:19 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/4 "2019-07-10T20:19:52Z")

</div>

I don't believe that the Dashboard is multi-user. So all connected clients will receive the same information.

If you wish to do more, you will need to forgo the easy layout offered by Dashboard and roll your own interface using uibuilder I think.

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [10 July 2019 20:22 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/5 "2019-07-10T20:22:22Z")

</div>

I Guess there is no session ID filtering then?

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [10 July 2019 21:32 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/6 "2019-07-10T21:32:08Z")

</div>

Nope. ☹

Dashboard is fabulous for getting going quickly but you eventually tend to hit a cliff. That's why I created uibuilder. No cliff but no hand-holding either I'm afraid. Still there are plenty of tools around that will design a layout for you.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [10 July 2019 22:28 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/7 "2019-07-10T22:28:15Z")

</div>

It should work to alert to the session . can you share your flow from button to alert ?

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [11 July 2019 15:11 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/8 "2019-07-11T15:11:09Z")

</div>

Sure here is the flow...

```auto
[{"id":"8465fd14.c6b5f","type":"function","z":"5ac8df83.57bca","name":"Send Switch Logic","func":"var canopy = global.get(\"Canopy_Override\").toString();\n\nif(canopy === \"ON\")\n{\n msg.newValue = \"0\";\n}\nelse if(canopy === \"OFF\")\n{\n msg.newValue = \"1\";\n}\nelse\n{\n msg.newValue = \"0\";\n}\nvar msg1;\nmsg1 = {payload:\"Sending Request, Stby...\"};\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"x":350,"y":2650,"wires":[["adba7273.42ac8"],["c4af39fe.323b18"]]},{"id":"c4af39fe.323b18","type":"ui_toast","z":"5ac8df83.57bca","position":"top right","displayTime":"5","highlight":"sandybrown","outputs":0,"ok":"OK","cancel":"","topic":"Lighting Override Request","name":"Override Request","x":590,"y":2690,"wires":[]}]

```

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [11 July 2019 15:46 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/9 "2019-07-11T15:46:45Z")

</div>

Hi,

so that doesn't include the button - but no matter... the output you have the notification on is the second one. You are creating a completely new msg1 for that output that doesn't include the `msg.socketid` that would have come from the button to indicate which browser to send the notification to...

So if you include `msg1.socketid = msg.socketid;` it should work

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [11 July 2019 17:42 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/10 "2019-07-11T17:42:47Z")

</div>

Just tried it... Did not work. Notification still appears on the other PC.  
☹

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 July 2019 20:05 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/11 "2019-07-11T20:05:36Z")

</div>

Post a flow that we can try that shows the problem. Your last one didn't include the button apparently.

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [11 July 2019 20:09 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/12 "2019-07-11T20:09:40Z")

</div>

OK,

```auto
[{"id":"593fa17d.0a7f2","type":"ui_button","z":"5ac8df83.57bca","name":"Canopy Override","group":"1218f184.feaaae","order":6,"width":0,"height":0,"passthru":false,"label":"{{msg.topic}}","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"Clicked","payloadType":"str","topic":"","x":140,"y":2650,"wires":[["8465fd14.c6b5f"]]},{"id":"8465fd14.c6b5f","type":"function","z":"5ac8df83.57bca","name":"Send Switch Logic","func":"var canopy = global.get(\"Canopy_Override\").toString();\n\nif(canopy === \"ON\")\n{\n msg.newValue = \"0\";\n}\nelse if(canopy === \"OFF\")\n{\n msg.newValue = \"1\";\n}\nelse\n{\n msg.newValue = \"0\";\n}\nvar msg1;\nmsg1 = {payload:\"Sending Request, Stby...\"};\n\nreturn [msg,msg1];","outputs":2,"noerr":0,"x":350,"y":2650,"wires":[["adba7273.42ac8"],["c4af39fe.323b18"]]},{"id":"c4af39fe.323b18","type":"ui_toast","z":"5ac8df83.57bca","position":"top right","displayTime":"5","highlight":"sandybrown","outputs":0,"ok":"OK","cancel":"","topic":"Lighting Override Request","name":"Override Request","x":590,"y":2690,"wires":[]},{"id":"1218f184.feaaae","type":"ui_group","z":"","name":"Lighting","tab":"e012b214.41c0d","order":6,"disp":true,"width":"4","collapse":false},{"id":"e012b214.41c0d","type":"ui_tab","z":"","name":"Site Supervisor Manager's Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

Hope this helps...Thanks..

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 July 2019 20:17 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/13 "2019-07-11T20:17:39Z")

</div>

You don't seem to have made the change to msg1 that @dceejay suggested

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [11 July 2019 20:52 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/14 "2019-07-11T20:52:25Z")

</div>

Oh, crap. I sent the wrong flow... Here ya go...

```auto
[{"id":"6c70282b.192b88","type":"ui_button","z":"5ac8df83.57bca","name":"Sign Override","group":"1218f184.feaaae","order":2,"width":0,"height":0,"passthru":false,"label":"{{msg.topic}}","tooltip":"","color":"{{msg.colour}}","bgcolor":"{{msg.background}}","icon":"","payload":"Clicked","payloadType":"str","topic":"","x":130,"y":2260,"wires":[["ac65c7e1.c10198"]]},{"id":"ac65c7e1.c10198","type":"function","z":"5ac8df83.57bca","name":"Send Switch Logic","func":"var sign = global.get(\"Sign_Override\").toString();\n\nif(sign === \"ON\")\n{\n msg.newValue = \"0\";\n}\nelse if(sign === \"OFF\")\n{\n msg.newValue = \"1\";\n}\nelse\n{\n msg.newValue = \"0\";\n}\nvar msg1;\nmsg1 = {payload:\"Sending Request, Stby...\"};\nmsg1.socketid = msg.socketid;\nreturn [msg,msg1];","outputs":2,"noerr":0,"x":330,"y":2260,"wires":[["21b106d3.fd0b9a"],["5cd04b19.c9cd14"]]},{"id":"5cd04b19.c9cd14","type":"ui_toast","z":"5ac8df83.57bca","position":"top right","displayTime":"5","highlight":"sandybrown","outputs":0,"ok":"OK","cancel":"","topic":"Lighting Override Request","name":"Override Request","x":580,"y":2300,"wires":[]},{"id":"1218f184.feaaae","type":"ui_group","z":"","name":"Lighting","tab":"e012b214.41c0d","order":6,"disp":true,"width":"4","collapse":false},{"id":"e012b214.41c0d","type":"ui_tab","z":"","name":"Site Supervisor Manager's Dashboard","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

```

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [11 July 2019 21:04 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/15 "2019-07-11T21:04:55Z")

</div>

I had to remove the code referencing the global context variable in order to get it to run (I hate global and flow context and never use them, but that is just a pet hate of mine, there are almost always other ways), but yes you are right, the notification does appear in all sessions. Over to @dceejay I think.

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [11 July 2019 22:24 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/16 "2019-07-11T22:24:54Z")

</div>

Ah - so... double checking the code :-)... alerts DO go to all clients... - but OK/Cancel dialogs don't. hmm - maybe should make that optional in next version ?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [12 July 2019 07:23 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/17 "2019-07-12T07:23:02Z")

</div>

I can imagine that sometimes one would want notification on all windows, and sometimes not, so making it optional sounds like a good idea.

---

<div class="post-metadata">

### Author: ![tcontrada](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@tcontrada](https://discourse.nodered.org/u/tcontrada)
#### Post date: [12 July 2019 13:18 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/18 "2019-07-12T13:18:34Z")

</div>

I agree, maybe a checkbox in the UI interface something like " **Notify in All Sessions**"

Thanks...

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [12 July 2019 13:40 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/19 "2019-07-12T13:40:27Z")

</div>

in master - not yet on npm

---

<div class="post-metadata">

### Author: ![FufsowyFufs](https://avatars.discourse-cdn.com/v4/letter/f/c5a1d2/32.png) [@FufsowyFufs](https://discourse.nodered.org/u/FufsowyFufs)
#### Post date: [15 August 2019 21:40 UTC](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126/20 "2019-08-15T21:40:15Z")

</div>

When can we expect a npm release?

[Next page](https://discourse.nodered.org/t/notification-shows-on-multiple-sessions/13126.md?page=2)
