Hi @greg18
I can’t claim any expert knowledge on this, but may be able to point you in the right direction to get some support from Bubble.
An http request is often called unidirectional, as it relies on the client asking the server for information, and the server sending it. The most well-known use case is to load the html and associated files for a web page. As soon as the information is sent from the server, the connection ends. Every time you need new information (by refreshing the page or loading another page) a new connection is established and then ends as soon as the information has been transmitted.
To keep a connection “live” and unidirectional, a technology called WebSockets is usually used. Unlike a regular http request, a WebSocket connection will be kept alive until it’s terminated by either the client or the server (or, as you say, by the loss of connection). WebSocket, data is continuously pushed/transmitted into the already open connection, thus making it a much more efficient way to run a dynamic web application.
You can inspect in Chrome Developer Tools that Bubble opens up a WebSocket connection when the page loads by filtering the Network traffic by the WS category:
If a connection is lost, there’s nothing built-in to the WebSocket protocol to reconnect - that’s up to the developer to set up. We can assume that Bubble has been built to try to reconnect if the connection is severed, but I don’t have any details about how exactly this works. Bubble’s support can probably shed some light on this: and it would be very interesting to hear more.
If you inspect the websocket in Developer Tools and click the Messages column, you may be able to check how the websocket behaves when you disconnect and reconnect your app.
- Is there a max duration that a connection can remain live, e.g. 24 hours? Or could a connection remain indefinitely as long as the internet connection was not interrupted?
A websocket connection can in theory last forever, but again it depends on how Bubble has set it up. I’ve successfully communicated with the server in a Bubble app after having left the page alone for a long time, but this is anecdotal so I don’t know the specifics.
As described in my 1st post, is the Current User data type more likely to have a stronger live connection to the database than other data types? Or would you expect all data types to experience a similar strength of connection?
I would expect all types to have the same connection strength, but from Developer Tools it seems that Bubble is watching the current User more actively than other page data, perhaps for security reasons. But the connection is technically the same, but it may be that Bubble initiates communication on the User more frequently.
Would a heavier page with higher DOM count be more likely to lose its connection to the Bubble server?
I don’t see any reason why DOM count would affect the connection.
Lastly, I’d encourage any devs (or @Bubble team members) with more knowledge on WebSockets to correct me or add to my info here – again I’m not an expert on this.