# Gateway message gone missing

**URL:** <https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [July 10, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016 "2024-07-10T14:53:17Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [July 10, 2024, 2:53pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/1 "2024-07-10T14:53:17Z")

</div>

My test setup is a Gateway timer script that sends a message using [system.util.sendMessage](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-sendMessage) that is supposed to be received by an event handler in a view object.

Here is the GW timer script that runs every 4 seconds

 ![GWScript](https://us1.discourse-cdn.com/inductiveautomation/original/3X/e/1/e1490bf8829d9e995961c253d14aba7878e40666.png)

Here is the event handler on the object

![Handler](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/e/aeeb17489f9b7fc7e99616c77a596cedad6264a1.png)

The project and message names match, and the GW script is writing to the wrapper log, but I am not receiving events on the object.

The only thing I can think of is that I am not receiving events because I am testing the object in the designer. Is that a possibility, and also how else do you debug messages?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 10, 2024, 3:01pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/2 "2024-07-10T15:01:02Z")

</div>

Messages sent to Perspective with `system.util.sendMessage()` are _ **only** _ received in Session Message Handlers.

Perspective views and components can only receive messages that come from `system.perspective.sendMessage()`. Consider using a session message handler to rebroadcast for components to receive.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [July 10, 2024, 4:32pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/3 "2024-07-10T16:32:07Z")

</div>

To be clear, you are talking about putting an event handler here that receives the GW message? (and that event handler then broadcasts a session message using system.perspective.sendMessage())

![Sessionevents](https://us1.discourse-cdn.com/inductiveautomation/original/3X/9/9/9924faed4ff44247a08424ded5cfc69f68bc9f41.png)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 10, 2024, 4:33pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/4 "2024-07-10T16:33:35Z")

</div>

Yes.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [July 10, 2024, 6:30pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/5 "2024-07-10T18:30:19Z")

</div>

Hmm .. so I added this script, and I get nothing in the wrapper log

 ![Session Message](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/b/bbdd6bc839df82dc51cf37e81139fb946247469f.png)

Obviously I am missing something.

---

<div class="post-metadata">

**Author:** ![Samuel\_Sueur](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@Samuel\_Sueur](https://forum.inductiveautomation.com/u/Samuel_Sueur)\
**Post date:** [July 10, 2024, 6:33pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/6 "2024-07-10T18:33:13Z")

</div>

Hi, if you're trying to print something in the logger, it's best to use [system.util.getLogger](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-getLogger)

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [July 10, 2024, 6:57pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/7 "2024-07-10T18:57:34Z")

</div>

Technically, yes I should use the logger functionality, but simple prints end up in the wrapper log as INFO messages. (and I did try the official logger for that message received above, and still got didly squat.)

---

<div class="post-metadata">

**Author:** ![lrose](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/lrose/32/62724_2.png) [@lrose](https://forum.inductiveautomation.com/u/lrose)\
**Post date:** [July 10, 2024, 7:06pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/8 "2024-07-10T19:06:49Z")

</div>

You've set up your message as follows:

```python
system.util.sendMessage(Project,Message,None,None,'CGS')

```

According to the manual page which you sited, the syntax is:

```python
system.util.sendMessage(project, messageHandler, [payload], [scope], [clientSessionId], [user],[hasRole], [hostName],[remoteServers])

```

So you've set your scope to `None`, when in reality if you want it to be "heard" by sessions the scope needs to be at least "s".

Try this:

```python
system.util.sendMessage(project = Project, messageHandler = Message, scope = "s")

```

See if you get a print out then.

---

<div class="post-metadata">

**Author:** ![peter](https://avatars.discourse-cdn.com/v4/letter/p/278dde/32.png) [@peter](https://forum.inductiveautomation.com/u/peter)\
**Post date:** [July 10, 2024, 7:09pm UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/9 "2024-07-10T19:09:09Z")

</div>

> [@peter](#):
>
> [system.util.sendMessage](https://www.docs.inductiveautomation.com/docs/8.1/appendix/scripting-functions/system-util/system-util-sendMessage)

Yep, one too many "None" in the call. And I totally missed it.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [July 11, 2024, 7:19am UTC](https://forum.inductiveautomation.com/t/gateway-message-gone-missing/93016/10 "2024-07-11T07:19:06Z")

</div>

Do as @lrose said and use named parameters whenever possible (sadly, some functions don't accept them) instead of relying on `None`s to put your parameter at the right place.
