[Bug] system.util.sendMessage fails with remoteServers when payload is not a dict

In Ignition 8.1.10, when calling system.util.sendMessage, if using scope=G and a value is specified for remoteServers, the message is never received on the remote server if payload is an Ignition type, such as com.inductiveautomation.perspective.gateway.script.PropertyTreeScriptWrapper$ObjectWrapper. I need to first convert the payload to a Python dict before sending the message.

This does not appear to be the case using scope=S if remoteServers is not specified. In that case, the message is sent successfully, even when payload is not a true dict.

To summarize, this works:

system.util.sendMessage(
		project='my-project',
		messageHandler='my-message',
		payload=self.custom.myCustomParam,
		scope='S')

But this does not:

system.util.sendMessage(
		project='my-project',
		messageHandler='my-message',
		payload=self.custom.myCustomParam,
		scope='G',
		remoteServers=myRemoteServerAddress)

Not terribly surprising, since Perspective runs in its own classloader (like all modules). Any scope other than ‘S’ won’t be able to deserialize a Perspective class instance (deserializing being required for objects passed through a network).

Not a bug, but a side effect of Ignition’s module isolation.

Makes perfect sense. Still, this behavior was unexpected, and it was difficult to figure out what was going wrong.

I think there’s an open ticket on our end about the Perspective wrapper objects “leaking” into scripting.

IGN-1660 if anyone else from IA is playing along. I’m going to add this thread to the ticket.