I'm trying to communicate to all perspective sessions of a project when a process is finished in the module. Here is a simplified version of how I do it for a single session given its session ID.
public void sendPerspectiveSessionMessage(UUID sessionId, String messageType, PyDictionary payload) {
var session = perspectiveContext.getSessionMonitor().findSession(sessionId);
if (session.isEmpty()) {
log.error("No active Perspective session with id {} found. Message of type {} not sent.", sessionId, messageType);
return;
}
var message = new UserScopeMessageEvent(messageType, payload);
session.get().queue().submit(() -> session.get().getEventManager().post(message));
}
Is there a way to obtain all sessions or session IDs? Or better yet, is there a way to communicate with all perspective sessions?
I see that PerspectiveSessionMonitor has a method getSessionInfos which returns a list of PerspectiveSessionInfo, but there is no accessor for ID. Are the IDs intentionally kept private?