# Unable to update text field on just one session using msg.socketid

**URL:** <https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373>\
**Category:** Dashboard\
**Created:** [2 December 2023 09:44 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373 "2023-12-02T09:44:07Z")\
**Posts on this page:** 8\
**Page:** 1

<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:** [2 December 2023 09:44 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/1 "2023-12-02T09:44:07Z")

</div>

I thought I should be able to update a text or text input field in just one of the connected sessions by including msg.socketid but I cannot get it to work.

I am using a ui\_control node to detect the opening of a dashboard tab and then passing that message on to the text nodes after adding a timestamp to msg.payload. I had expected that to only update the tab on the device that has just opened the tab, but I see that all connected devices receive the new timestamp. Should this flow operate as I expected or am I incorrect?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/b/3b13ce3c7e230c2ec1d032a7388cca3121f46a5a.png)

```auto
[{"id":"1821b1188180a4c6","type":"ui_ui_control","z":"bdd7be38.d3b55","name":"","events":"all","x":140,"y":3100,"wires":[["50f33ee13411047e"]]},{"id":"cf55096d8fbff95b","type":"ui_text","z":"bdd7be38.d3b55","group":"903a6ab8.4f4ca8","order":3,"width":0,"height":0,"name":"","label":"ui_text","format":"{{msg.payload}}","layout":"row-spread","className":"","style":false,"font":"","fontSize":16,"color":"#000000","x":730,"y":3080,"wires":[]},{"id":"bc151026b9db7aca","type":"function","z":"bdd7be38.d3b55","name":"Add timestamp","func":"msg.payload = new Date().toISOString()\nreturn msg;","outputs":1,"timeout":0,"noerr":0,"initialize":"","finalize":"","libs":[],"x":520,"y":3100,"wires":[["cf55096d8fbff95b","ab3b4ae211852e81"]]},{"id":"ab3b4ae211852e81","type":"ui_text_input","z":"bdd7be38.d3b55","name":"","label":"ui_text_input","tooltip":"","group":"903a6ab8.4f4ca8","order":4,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"topic","sendOnBlur":true,"className":"","topicType":"msg","x":730,"y":3140,"wires":[[]]},{"id":"50f33ee13411047e","type":"switch","z":"bdd7be38.d3b55","name":"Home?","property":"name","propertyType":"msg","rules":[{"t":"eq","v":"Home","vt":"str"}],"checkall":"true","repair":false,"outputs":1,"x":300,"y":3100,"wires":[["5d460a612a21cdcd","bc151026b9db7aca"]]},{"id":"5d460a612a21cdcd","type":"debug","z":"bdd7be38.d3b55","name":"debug 116","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":470,"y":3040,"wires":[]},{"id":"903a6ab8.4f4ca8","type":"ui_group","name":"Home","tab":"e2e6f4f5.56f91","order":1,"disp":false,"width":"6","collapse":false,"className":""},{"id":"e2e6f4f5.56f91","type":"ui_tab","name":"Home","icon":"dashboard","order":3,"disabled":false,"hidden":false}]

```

---

<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:** [2 December 2023 09:50 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/2 "2023-12-02T09:50:10Z")

</div>

You are incorrect. There is only one source of truth. We can’t have indicators saying the power is off when it may be on.

---

<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:** [2 December 2023 10:14 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/3 "2023-12-02T10:14:33Z")

</div>

Ok, it was posts like [this](https://discourse.nodered.org/t/button-and-socketid/63731/2) that led me astray I think.

> [@dceejay](#):
>
> We can’t have indicators saying the power is off when it may be on.

I am not sure it is a well defined a question as that. If the developer decided he wanted to affect only the current tab when a button is clicked, for example, there is no reason why that should not be allowed. However, if that is the way it is then that is ok. I don't actually need to do this, I was just exploring the capability with a view to the design of Dashboard 2.0.

So is it just notifications, navigation and show/hide that are affected by the socketid?

---

<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:** [2 December 2023 11:22 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/4 "2023-12-02T11:22:07Z")

</div>

Correct.  
At the end of the day. Until you have separate user login sessions then there can only ever be one state of a widget held in a flow. Of course the browser client can hold it own state, but then who do you trust? That is a design decision, and we (I) chose to stick with the server being the source of truth.

---

<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:** [2 December 2023 11:40 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/5 "2023-12-02T11:40:26Z")

</div>

OK, thanks.

---

<div class="post-metadata">

**Author:** ![omrid](https://avatars.discourse-cdn.com/v4/letter/o/77aa72/32.png) [@omrid](https://discourse.nodered.org/u/omrid)\
**Post date:** [3 December 2023 10:48 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/6 "2023-12-03T10:48:39Z")

</div>

The text-box node is global. whatever value it receives will show on all sessions.

You have the option to use a **ui-template** node and define a session-specific text box in HTML.  
Messages which include a session indicator ( **msg.socketid** ), will only be received by the text box of same current session.

In case the message comes without a session indicator (e.g. comes from a non-dashboard node), you can mimic this behavior, using a hidden HTML field, initialized with a unique UUID.

I have a working example of this, in case you are interested.

---

<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:** [3 December 2023 11:24 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/7 "2023-12-03T11:24:27Z")

</div>

OK, thanks, as I said, I don't need to do this, I was just clarifying my understanding of how the current dashboard works.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [2 January 2024 11:24 UTC](https://discourse.nodered.org/t/unable-to-update-text-field-on-just-one-session-using-msg-socketid/83373/8 "2024-01-02T11:24:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
