I'm building a server using the open62541 OPC UA stack version 1.0. This works great so far.
When a client disconnects I need to do some maintenance at server side. Is there a possibility to execute a callback when a client disconnects from the OPC UA server? Alternatively also a "session closed" or "secure channel closed" can help.
Thanks for support.
EDIT: ... so, I checked again the documentation of the Access Control API but it's not clear to me how to apply it for my problem. If i run the server with
int main(void) {
signal(SIGINT, stopHandler);
signal(SIGTERM, stopHandler);
UA_Server *server = UA_Server_new();
UA_ServerConfig_setDefault(UA_Server_getConfig(server));
UA_StatusCode retval = UA_Server_run(server, &running);
UA_Server_delete(server);
return retval == UA_STATUSCODE_GOOD ? EXIT_SUCCESS : EXIT_FAILURE;
}
I only have the server pointer and maybe the config. From here how is the server notified when a client connects/disconnects and how can i catch this event or do i need to periodically check if there are connected clients using a Timed Callback? If yes how? And where comes the Access Control API into game?
Thanks again
You can use the Access Control Plugin API, to get when a client connectes and disconnectes. (activateSession/closeSession).
See: