log event subscription, clients listening..

Questions regarding the use of the C++ SDK for Server or Client development or integration into customer products ...

Moderator: uasdkcpp

Post Reply
Stefan_L_01
Hero Member
Hero Member
Posts: 20
Joined: 18 Nov 2016, 20:17

log event subscription, clients listening..

Post by Stefan_L_01 »

Hello
Is there a way to log when a client subscribes / unsubcribes to an event, to see what event will be sent out to which client? Is there a kind of callback for those happenings?
Thx for information
Stefan

User avatar
Support Team
Hero Member
Hero Member
Posts: 3208
Joined: 18 Mar 2011, 15:09

Re: log event subscription, clients listening..

Post by Support Team »

Hi,

The EventManagerBase provides a method beforeSendEvent() that is called whenever the SDK sends an event to any client.

The intend of the method is to add custom checks and control if the event shall be fired or not. However, you can still use that method, extract the info you need and always return true. This method should not block i.e. you should not call any operation from here that potentially take a long time to terminate.

see: https://documentation.unified-automation.com/uasdkcpp/1.8.5/html/classEventManagerBase.html#ae5836ede70d588e29127971af970d851
Best regards
Unified Automation Support Team

Stefan_L_01
Hero Member
Hero Member
Posts: 20
Joined: 18 Nov 2016, 20:17

Re: log event subscription, clients listening..

Post by Stefan_L_01 »

Hello Support team
I use the method already and I can log that we sometimes send out events twice, 3x... to the very same client!
This happens after a reconnect scenario, e.g. when my server closes and reopens.
The client (c#) claims he is dealing with a disco/reco scenario correctly, even closing the connection and reopens only one connection.
However as said he receives after such a scenario multiple event data - and is blaiming the server.
I can assure the server fires the event only once.

I really would like to log when a client subscribes to an event, to understand when and why 2 or more subscribtions to same event of same client happen - or why one subscribtion might be still alive even if client is closing it.
Thank you for help
Stefan

Post Reply