0
votes

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

1
Welcome to StackOverflow. What have you investigated (any hints in the documentation)? - Jeroen Heier
I investigated the Access Controm API documentation (as Schroeder answered) but I can't find a way/solution to get the Access Control "object" and within that the status info of connected clients... Maybe I have to investigate a little bit more with the using the links that Schroeder posted... - SRA
And thanks for the welcome. - SRA

1 Answers

0
votes

You can use the Access Control Plugin API, to get when a client connectes and disconnectes. (activateSession/closeSession).

See:

Access Control documentation

The default plugin as starting point