# System.perspective.download files size limit 2meg? How to download large CSVs?

**URL:** <https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972>\
**Category:** Ignition\
**Tags:** ignition81, perspective, scripting\
**Created:** [May 19, 2023, 8:23pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972 "2023-05-19T20:23:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dean\_McClure](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Dean\_McClure](https://forum.inductiveautomation.com/u/Dean_McClure)\
**Post date:** [May 19, 2023, 8:23pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/1 "2023-05-19T20:23:07Z")

</div>

Hi as per the title I have a python script which creates a csv from a number of perspective properties but I have run into an issue where the filesize of the csv is too big for the system.perspective.download function which gives me:

`Websocket connection closed unexpectedly. code=1009, reason=Text message too large: (actual) 2,103,744 > (configured max text message size) 2,097,152, codeMeaning=Message Too Big, codeDescription=The endpoint is terminating the connection because a data frame was received that is too large.`

Is there any work around for this? I've already split up the CSV as much as I can and I'm still way over the limit in the worst case scenario (in the above case I'm marginally).

Any thoughts for suggestions?

---

<div class="post-metadata">

**Author:** ![Matthew.gaitan](https://avatars.discourse-cdn.com/v4/letter/m/59ef9b/32.png) [@Matthew.gaitan](https://forum.inductiveautomation.com/u/Matthew.gaitan)\
**Post date:** [May 19, 2023, 8:28pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/2 "2023-05-19T20:28:45Z")

</div>

> [@Gateway Crashing when passing view parameter](https://forum.inductiveautomation.com/t/gateway-crashing-when-passing-view-parameter/41392/25):
>
> As my colleague @cmallonee mentioned, for those who need steps to add/modify the websocket max message size for Perspective, you will need to do the following to add the JVM parameter to Ignition: Open the ignition.conf file that is located in the data folder that’s found in your Ignition installation path Open the ignition.conf with any text editor Within the ignition.conf file, scroll down to where it says # Java Additional Parameters; This is the location where JVM parameters are added into…

We get this message in our logs pretty frequently. I haven't tried to find out what component / script causing it yet as we haven't heard any complaints **knock on wood**. Hopefully the linked reply resolves it for you.

---

<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:** [May 19, 2023, 8:32pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/3 "2023-05-19T20:32:36Z")

</div>

Hmm. `system.perspective.download` doesn't send the actual file contents over the websocket. It temporarily hosts the file at a unique ID and sends the URL to fetch it down to the browser to download. It's odd it's correlated with these messages.

If you look in browser devtools when you first open the session, you can see the initial websocket message and open it to see all the traffic back and forth. I'd be interested (from the browser's side) what's actually being sent when you get these messages on the gateway.

---

<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:** [May 19, 2023, 9:29pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/4 "2023-05-19T21:29:49Z")

</div>

Are you trying to also apply the csv content to a Perspective session or component property? That would cause it to be transferred in the websocket, too. (Don't do that.)

---

<div class="post-metadata">

**Author:** ![Dean\_McClure](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Dean\_McClure](https://forum.inductiveautomation.com/u/Dean_McClure)\
**Post date:** [May 23, 2023, 5:30pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/5 "2023-05-23T17:30:41Z")

</div>

Thanks for the replies everyone. Ideally I don't want to mess with the JVM parameters as I don't want any roll on effects which might cause gateway performance to be affected.

This is very helpful information @paul-griffith and @pturmel I had a bit more of a look inside. I am transferring data in and out of perspective session properties as a temporary storage area to work on the data. I have some code that communicates with gateways, pulls the data across and then joins it together and stores it in a perspective session component for manipulation and export (or sending back to the gateways immediately if desired).  
Is there a better place to store this type of information? I was using the perspective session properties because it is persistent across a single session (which is relevant for this as I don't want to use a gateway tag etc as I want the data unique to a particular session so users cannot affect each others data). The data all comes in asynchronously from the gateway network as the operations take quite a while for the gateways to perform which can lead to timeouts otherwise.

(screenshot below of the download inside of the perspective session, I'm using a much smaller dataset here to try and get the operation to succeed)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/a/0/a0369a332f1024011636c58a8c9ae7d02863b1fc.png)

and likewise an unsuccessful operation with significantly more data below (with the grey "No Connection to Gateway" banner)

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/7/879cd8a1d63fb46c90783e1d060d1d091f1b4ed3.jpeg)

Thanks again.

---

<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:** [May 23, 2023, 5:39pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/6 "2023-05-23T17:39:18Z")

</div>

If you don't actually need all of those properties on the frontend (in components) then I believe right clicking them and marking them as private prevents them from being synced over the websocket. If that doesn't work, or you want more control, you could also store a dictionary in `system.util.getGlobals` - use the session ID as a key, and then you can store whatever values you want of whatever size you want, subject only to your gateway's memory limitations. Be careful to only store native Python types (not your own defined classes) to avoid a memory leak.

---

<div class="post-metadata">

**Author:** ![Dean\_McClure](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Dean\_McClure](https://forum.inductiveautomation.com/u/Dean_McClure)\
**Post date:** [May 23, 2023, 9:07pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/7 "2023-05-23T21:07:41Z")

</div>

What are my options if I do need those in the front end?  
I make the data available to the user to inspect the data and make tweaks before deployment as well as making large scale changes to the gateway device and tag configuration.

setting them as private does indeed help and allow the operation to work but it breaks a bunch of things on the front end (as expected)

Thanks again.

---

<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:** [May 23, 2023, 9:53pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/8 "2023-05-23T21:53:47Z")

</div>

Your only other option, really, is to allow the websocket to send larger message payloads.

I think sending datasets vs objects and arrays is _slightly_ more efficient, which would buy you a little bit of overhead, but not a ton.

---

<div class="post-metadata">

**Author:** ![Dean\_McClure](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Dean\_McClure](https://forum.inductiveautomation.com/u/Dean_McClure)\
**Post date:** [May 24, 2023, 11:34pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/9 "2023-05-24T23:34:05Z")

</div>

OK thanks, is there a good way to do this?  
just this line?  
`wrapper.java.additional.X=-Dperspective.websocket.max-message-size=#`

---

<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:** [May 24, 2023, 11:35pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/10 "2023-05-24T23:35:17Z")

</div>

Yeah, the instructions in the linked forum post above are accurate.

---

<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:** [May 24, 2023, 11:43pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/11 "2023-05-24T23:43:09Z")

</div>

Another option would be to manually render your large file into an iframe via the WebDev module. That would deliver content outside Perspective's websocket.

Keep in mind that sending very large payloads through the websocket can greatly harm interactivity for other components.

---

<div class="post-metadata">

**Author:** ![Dean\_McClure](https://avatars.discourse-cdn.com/v4/letter/d/f0a364/32.png) [@Dean\_McClure](https://forum.inductiveautomation.com/u/Dean_McClure)\
**Post date:** [May 25, 2023, 3:51pm UTC](https://forum.inductiveautomation.com/t/system-perspective-download-files-size-limit-2meg-how-to-download-large-csvs/73972/12 "2023-05-25T15:51:38Z")

</div>

Yeah I am very much not inclined to make the websocket size excessively large, the gateways I have are already precarious as it is.  
@pturmel I was just patiently waiting for you to let me know how WebDev module would solve all my problems! 🙂
