Client-side websocket with much less ['lastupdated'], is it possible?

Hello,
I’m using the websocket client, which is really great. I find it more useful to process only devices that have changed rather than making an API request on a device, retrieving the state of a device, checking if it has changed, and if so, processing it.

It’s easy to process messages received via the websocket in JSON since they are all ‘changed’. In my use case, I ignore JSON messages whose first key is “attr” that don’t have a changed ‘state’, and I process the others. My goal is to retrieve the ‘state’ key of each message and process it. It works very well, except that I encounter this situation quite often:

{“e”:“changed”,“id”:“140”,“r”:“sensors”,“state”:{“alarm”:false,“demain”:“----”,“lastupdated”:“2025-07-02T08:21:10.081”,“ltarf”:“”,“ngtf_optarif”:“BBR(”,“ntarf”:0,“production”:0,“stge”:“”,“tariffPeriod”:“HPJB”},“t”:“event”,“uniqueid”:“00:15:8d:00:06:20:57:06-01-ff66”}
{“e”:“changed”,“id”:“140”,“r”:“sensors”,“state”:{“alarm”:false,“demain”:“----”,“lastupdated”:“2025-07-02T08:21:10.145”,“ltarf”:“”,“ngtf_optarif”:“BBR(”,“ntarf”:0,“production”:0,“stge”:“”,“tariffPeriod”:“HPJB”},“t”:“event”,“uniqueid”:“00:15:8d:00:06:20:57:06-01-ff66”}
{“e”:“changed”,“id”:“140”,“r”:“sensors”,“state”:{“alarm”:false,“demain”:“----”,“lastupdated”:“2025-07-02T08:21:10.273”,“ltarf”:“”,“ngtf_optarif”:“BBR(”,“ntarf”:0,“production”:0,“stge”:“”,“tariffPeriod”:“HPJB”},“t”:“event”,“uniqueid”:“00:15:8d:00:06:20:57:06-01-ff66”}

In these three consecutive messages, I retrieve the ‘state’ key, and the only modification is ‘lastupdated’.
This is annoying because it limits a major benefit of the websocket: transmitting only modified messages.
To compare the ‘state’ values, I have to delete $json[‘state’][‘lastupdated’] and compare them afterward.
This is possible; I do it systematically now, but I must say it’s very annoying.
I sometimes need ‘lastseen’ information, but I’ve never needed ‘lastupdated’.
Is it possible to not transmit [‘state’][‘lastupdated’] in the websocket?
Or is it possible to have an option somewhere to not receive this key in messages if you don’t want it. [‘lastupdated’] probably makes sense on the server side, but for me on the client side, [‘lastupdated’] is making my life harder.
My message was a bit long, but I feel like I’m constantly checking that a message contains the key [‘lastupdated’] and deleting it, just because time is passing…

Same for me.
For me "e": "changed" mean there is a change.

changed - resource attributes have changed;

But the problem is some device can send a new notification but with the same value like “state/buttonevent” (if you press the same button again 10 s after) or some alarm device that send notification when triggered but never return to off/false.

So IDK how to filter thoses boring notifications, not possible to set a minimum timer by fields.

Client-side filtering is annoying; you always have to compare arrays, the nth with the n-1 of the same [‘id’].
Ideally, JSON files whose only the [‘lastupdated’] key is modified should not appear in websocket messages. Either never, or with an option somewhere where everyone chooses to receive them or not. But I think this annoys everyone.
Another possible solution might be to transmit an additional key in the message indicating that only the [‘lastupdated’] key has been modified. [‘lastupdated’] remains, but on the client side, this additional key in the message allows messages containing it to be ignored. And it shouldn’t penalize systems that operate with the current state of the websocket. This allows client-side sorting without performing an n-n-1 comparison and without deleting anything from the transmitted frame.

To support my request, I put a small counter on all the json messages received and another on the messages with array_first_key ‘e’ transmitted on websocket.
Then I count the array_first_key ‘e’ which appear only with [‘lastupdated’] modified and a counter of the useful array_first_key ‘e’, ​​with modified device states.
And I left the meters running for an hour on my home automation
In one hour I received and processed 1247 messages.
629 were array_first_key ‘e’
529 of these had only the [‘lastupdated’] field modified
100 contained modified ‘state’ data that interests me to manage my home automation
85% of array-key_first 'e’s are not useful for my home automation.
Overall, 50% of messages are easily eliminated with array_key_first. For the other 50%, you need to systematically compare [‘id’][‘r’] with the previous state.
You need to manage an array of values, delete [‘lastupdated’], and compare…
A tag in the JSON, ideally a different array_key_first to identify the true ‘modified’ messages from the others, would be great.
I’d love to hear the opinion of a decision-maker on websocket.
Have a nice day.

There is an option to only send changed data over websocket. Its in the websocket documentation i think

You mean the websocketnotifyall setting ?
When I have tried it, It decrease the field number in the notification, but not the notification number.

Exactly. Ok