The Main app (or Browser Platform) in the context of io.Connect Browser is a web app that uses the
@interopio/browser-platform library. This app is responsible for configuring the entire io.Connect environment and acts as a central hub for all Browser Client apps in your io.Connect Browser project. All io.Connect operations are routed through this Main app, meaning that this is the place where you can get centralized logging, information about all operations and details about the general state of your project. The configuration for all io.Connect libraries (e.g., App Management, Layouts, Workspaces, Plugins, Notifications) is handled here.
The Main app also provides tracking and control over non-io.Connect apps opened through it. The level of control is limited, but all basic operations are available - open, close, receiving events, listing, adding and manipulating via Workspaces.
Keep in mind the following important characteristics and limitations of the Main app:
It's mandatory for an io.Connect Browser project to have a Main app (Browser Platform), because it handles the entire io.Connect environment which connects all Browser Client apps. In order for a Browser Client app to be connected to the io.Connect environment, it must be opened by the Browser Platform app or by another Browser Client already connected to the io.Connect environment.
The Main app must be the only entry point of the project for the end users to ensure that it's running before any Browser Client app has been opened.
If the Main app is closed, all Browser Client apps will lose their connection to io.Connect and therefore to all io.Connect capabilities. Opening the Main app again won't reestablish the connection, because this will effectively be an entirely new window with a new session and new context. However, if the Main app is refreshed, the existing Browser Client apps will detect this and will reconnect as soon as the Main app is back online.
Due to browser limitations, the Browser Platform app window can't be manipulated through the Window Management or App Management APIs (closed, moved, etc.). The Main app is designed to be opened manually by the end users - if it hasn't been opened by a script, it can't be manipulated by a script.
It's possible for the user to open more than one instance of the Main app. However, there will be no connection between the windows opened by the different Main app instances or between the Main app instances themselves, unless the subsequent Main apps are opened by another Main app. If a Main app is started by another Main app, then it falls back to being a regular Browser Client app and it will be connected to the Main app that has started it and to all other Browser Client apps opened by the same Main app.