# Reading gateway tags in a client

**URL:** <https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212>\
**Category:** Ignition\
**Created:** [August 30, 2017, 11:33pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212 "2017-08-30T23:33:43Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![iamthebull](https://avatars.discourse-cdn.com/v4/letter/i/58f4c7/32.png) [@iamthebull](https://forum.inductiveautomation.com/u/iamthebull)\
**Post date:** [August 30, 2017, 11:33pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/1 "2017-08-30T23:33:43Z")

</div>

Do clients store and cache a local copy of tag values? When I read a tag in a gateway tag provider from a client (ie via system.tag.read()) does that request go all the way to the gateway each time? I know that the client polls the gateway for tag values and such at an adjustable polling rate. When I read a tag value will the script wait until a fresh value is received from the gateway or return a locally cached value?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 31, 2017, 1:03am UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/2 "2017-08-31T01:03:14Z")

</div>

It goes to the gateway if it’s not a client tag.

---

<div class="post-metadata">

**Author:** ![iamthebull](https://avatars.discourse-cdn.com/v4/letter/i/58f4c7/32.png) [@iamthebull](https://forum.inductiveautomation.com/u/iamthebull)\
**Post date:** [August 31, 2017, 1:11am UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/3 "2017-08-31T01:11:45Z")

</div>

What if the tag is in a leased scan class with the slow rate set to zero? The gateway may not be actively polling the tag if it’s not visible in any client window. Will the script then wait for the gateway to fetch a value from the OPC server?

---

<div class="post-metadata">

**Author:** ![iamthebull](https://avatars.discourse-cdn.com/v4/letter/i/58f4c7/32.png) [@iamthebull](https://forum.inductiveautomation.com/u/iamthebull)\
**Post date:** [August 31, 2017, 1:16am UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/4 "2017-08-31T01:16:05Z")

</div>

Does the client polling rate only apply to tag values that are bound to window components?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 31, 2017, 12:40pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/5 "2017-08-31T12:40:19Z")

</div>

There’s no client polling of tags. Tags being read through the binding system are subscribed from the gateway, and the gateway sends change notifications to the clients. No change, no comms traffic.  
system.tag.read() and friends make a round trip to the gateway to get the latest value of the tag, and will not cause an OPC read. The script function access doesn’t count as a lease for triggering a faster read pace. Only the binding subscriptions count as a lease.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 31, 2017, 1:21pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/6 "2017-08-31T13:21:35Z")

</div>

> [@pturmel](#):
>
> Tags being read through the binding system are subscribed from the gateway, and the gateway sends change notifications to the clients. No change, no comms traffic.

Kinda true. It is a "subscription" and only changes are sent, but it's purely polling based, and the polling happens whether you've got values changing or not (because... it's polling, there's no way to know). The client poll rate setting effects the rate at which this occurs.

As for when you system.tag.read() an OPC tag in a leased scan class with 0 slow rate while it's currently not leased... I'd assume you get the last value it had. If you want it to go to the OPC server then use system.opc.readValue().

---

<div class="post-metadata">

**Author:** ![iamthebull](https://avatars.discourse-cdn.com/v4/letter/i/58f4c7/32.png) [@iamthebull](https://forum.inductiveautomation.com/u/iamthebull)\
**Post date:** [August 31, 2017, 4:29pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/7 "2017-08-31T16:29:29Z")

</div>

> [@Kevin.Herron](#):
>
> Kinda true. It is a "subscription" and only changes are sent, but it's purely polling based, and the polling happens whether you've got values changing or not (because... it's polling, there's no way to know). The client poll rate setting effects the rate at which this occurs.

Still confused here... If it's a subscription then there is no need for polling and vice versa. What, more precisely, is happening at the poll rate?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [August 31, 2017, 4:34pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/8 "2017-08-31T16:34:44Z")

</div>

Changes are not sent from gateway to client unsolicited. Comms between client/designer and gateway are HTTP-based. The gateway is aware of the tags the client is interested in (the subscription).

At the poll rate, the client continually asks the gateway for any values in its subscription that have changed.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [August 31, 2017, 6:21pm UTC](https://forum.inductiveautomation.com/t/reading-gateway-tags-in-a-client/15212/9 "2017-08-31T18:21:00Z")

</div>

Huh. I thought the connection to the gateway used websockets to upgrade to an asynchronous bi-directional messaging connection. /-:
