Sending files between gateways

Hi,

I'm trying to send a (zip) file (generated from a Perspective application) stored on an Ignition server to another Ignition server.

The gateways are connected through gateway network and are already exchanging information using messages handlers.

What would be the best way to achieve this?

Thanks

How large is the file?

You can use system.util.sendRequest for this, but I wouldn't recommend it for a payload of more than a megabyte or two because you're going to block the GAN websocket while that large payload is serialized.

We don't directly expose any primitives to allow larger payloads to be sent, but you could use Webdev or Phil's Blob Server module to allow a direct HTTP download "out of band" after a communication message via sendRequest.

That is, something like:

  1. Server A: User creates file
  2. Server A: Stores file on disk/database/etc
  3. Server A: Broadcasts 'control' message to server B indicating download location w/ system.util.sendMessage
  4. Server B: Message handler receives message and initiates an HTTP call via system.util.sendRequest to server A
4 Likes

The file size will vary, since it's an archive of images and PDFs but we can assume that it can easily be more than a megabyte.

Thank you for the proposed solution. I will try to implement it

You could also use the WebDev module if both gateways can't acces to the same disk locations. Is a bit worse in my opinion than what @PGriffith suggested.

We had use this in the past to send data and worked great (In our case were plain files that were reconstructed on destination)

1 Like

Another option would be to use ftp, which is pretty simple to script in python. Put filezilla on one or the other and just send it. Make sure you turn on binary mode, and depending on speed it would probably be good to do the actual ftp in a system.util.invokeAsynchronous to avoid blocking the original thread.