Gateway message gone missing

My test setup is a Gateway timer script that sends a message using 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

Here is the event handler on the object

Handler

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?

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.

1 Like

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

Yes.

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

Obviously I am missing something.

Hi, if you're trying to print something in the logger, it's best to use system.util.getLogger

1 Like

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.)

You've set up your message as follows:

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

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

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:

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

See if you get a print out then.

1 Like

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

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