# How to send message from module to all Perspective sessions

**URL:** <https://forum.inductiveautomation.com/t/how-to-send-message-from-module-to-all-perspective-sessions/112265>\
**Category:** Module Development\
**Tags:** ignition81, perspective\
**Created:** [November 19, 2025, 3:10am UTC](https://forum.inductiveautomation.com/t/how-to-send-message-from-module-to-all-perspective-sessions/112265 "2025-11-19T03:10:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyler\_Dolan](https://avatars.discourse-cdn.com/v4/letter/t/b5ac83/32.png) [@Tyler\_Dolan](https://forum.inductiveautomation.com/u/Tyler_Dolan)\
**Post date:** [November 19, 2025, 3:10am UTC](https://forum.inductiveautomation.com/t/how-to-send-message-from-module-to-all-perspective-sessions/112265/1 "2025-11-19T03:10:31Z")

</div>

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.

```java
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?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [November 19, 2025, 8:13am UTC](https://forum.inductiveautomation.com/t/how-to-send-message-from-module-to-all-perspective-sessions/112265/2 "2025-11-19T08:13:17Z")

</div>

> **[system.util.sendMessage | Ignition User Manual](https://docs.inductiveautomation.com/docs/8.3/appendix/scripting-functions/system-util/system-util-sendMessage)**
>
> This function sends a message to clients running under the Gateway, or to a project within the Gateway itself.

---

<div class="post-metadata">

**Author:** ![dillon](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dillon/32/81537_2.png) [@dillon](https://forum.inductiveautomation.com/u/dillon)\
**Post date:** [November 19, 2025, 2:17pm UTC](https://forum.inductiveautomation.com/t/how-to-send-message-from-module-to-all-perspective-sessions/112265/3 "2025-11-19T14:17:44Z")

</div>

Have the `util` function then call [system.perspective.sendMessage](https://docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-perspective/system-perspective-sendMessage) if you need to adjust components or properties in the session scope.

Update: oop, I just saw the Module Development tag. Sorry if this wasn't what you were looking for!

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 19, 2025, 4:47pm UTC](https://forum.inductiveautomation.com/t/how-to-send-message-from-module-to-all-perspective-sessions/112265/4 "2025-11-19T16:47:59Z")

</div>

> [@Tyler\_Dolan](#):
>
> Is there a way to obtain all sessions or session IDs?

I think you're at it, with `PerspectiveSessionMonitor`.

> [@Tyler\_Dolan](#):
>
> Or better yet, is there a way to communicate with all perspective sessions?

No, I don't think any such API exists (and anything we did have would be essentially what you're going to do - get all the sessions, broadcast a message to each one).

> [@Tyler\_Dolan](#):
>
> Are the IDs intentionally kept private?

I don't think it's intentional or that these are meant to be 'secret' - it's just that none of our code has ever needed to expose that on the wrapped object you get from the overall list.

We use, internally, the `PerspectiveSessionInfo.SimplifiedGsonEncoder` to power the JSON encoding used in the routes.  
You could, and I fully agree that this is hokey and unpleasant, get the full list, JSON encode it, and then pluck the `id` member from each encoded JSON object, e.g. by creating your own GSON adapter:

```java
        gson = PerspectiveModule.createPerspectiveCompatibleGson(b -> {
            b.registerTypeHierarchyAdapter(
                PerspectiveSessionInfo.class,
                new PerspectiveSessionInfo.SimplifiedGsonEncoder());
        });

```

I'd probably just reflectively pull the `id` field off the object before I did that, though 🤷
