Design
Terminology
Listener: A data structure that contains a name and a key used to identify a game instance.
Bifrost port: The TCP port Bifrost transport protocol is listening to for incoming connections.
Sender: An object responsible to accept incoming connection from the game instance by initiating a callback request to the Heimdall service and listening on a TCP server.
Service created key: A randomly generated key returned by the Heimdall service when a listener registers that may be used to re/de-register a Listener.
Endpoint: The address and port of a host.
Brief
A game instance that is behind a firewall, sends a request to the Heimdall service to register itself with Listener information.
A tool, AKA Sender, can then send a request to the Heimdall service to notify a specific Listener to connect to it.
If the specified Listener is found, Heimdall service will forward the Endpoint of the Sender to the game instance.
It is then the game instance job to establish connection with the Sender.
Error Handling
All errors that are encountered when communicating with the Heimdall service are handled by logging them and retrying again except when:
An authentication error was encountered.
The listener is already registered.
Operation is canceled by the user via
StopPollmethod.Service returns an invalid response.
If any of the above is encountered, the Heimdall Poller logs the error and terminates since retrying would return the same error. Note that the above list may change as we complete further testing and investigation.
Any error encountered when establishing a connection with a sender is logged, and afterwards, the Heimdall Poller simply continues polling for the next request.
IP Address Changes
If the IP address of the game instance changes during run time, it is automatically updated upon the next register call to the Heimdall service. This is because the Heimdall service stores the IP address of the registered Listener with the public address found in the HTTP request header.