Hello community,
I'm currently trying to declare a global variable in which I can store an object.
My use case is as follows:
As my app loads, I open a persistent connection to a server (per web sockets) in a Custom Action. I save the object that is created after the connection is established in a variable. However, this variable should be global because I would like to send over the established connection data at various points in my app via another custom action.
I therefore have two custom actions:
An action that is called directly at load screen and that should save the connection in a global variable
Another action that uses the object from the global variable
How I would normally do it:
Import websockets as Websocket;
Websocket MyConnection;
main() {
MyConnection.createConnection();
}
sendData(data) {
MyConnection.sendData(data);
}
I know that I can basically use App State. But there I can declare only specific data types like string or integer. Not an object.
Does somebody has any idea?