Widgets using `grist-plugin-api.js` and API limits

Hi everyone, thanks for making grist such a great and flexible tool to use!

I have a question regarding the data flow when using `grist-plugin-api.js` from a widget. For example when using `fetch` to get the content of a table.

Does the data exchange happen purely locally to the browser, by using iframe’s “postMessage” or custom events capabilities, or does it transit via the server ?

In the later case, do these requests count against the API usage limits ?

Thanks in advance for the clarifications. I am working on rather complex widgets that need to fetch the entire document to work, and I am wondering whether that’s a reasonable use…

Hi @Odysseus_Trentehin, custom widget calls like that do in general transit to the server, but don’t count as API usage against any existing or planned limits.

Thanks a lot for the fast answer.

I started digging a bit, and it looks like queries are forwarded to the host page ( grist-core/app/plugin/grist-plugin-api.ts at 506c093a228cac59040bbaf45fb7df573a2bacf3 · gristlabs/grist-core · GitHub ), but then I guess according to your answer that the host page performs an API call to answer instead of using it’s current known state.

Calls cross to the host page using postMessage, and then (depending on the exact call, but typically) across a websocket to the server.