This action is used to start the connection process and attempt to connect to a server.

This action takes one string parameter, which is the server hostname (and optionally the port) to connect to.

Triggered responses

If the connection is not successful, e.g. due to server being non-responsive, you will get an On error event.

If the connection succeeds but is denied, you will get Connection > On connection denied followed by Connection > On disconnect.


A UDP bug is present in Relay Server that will prevent approved connections ever completing, but this bug is fixed in Blue Server. No events will be triggered by a server having this bug, even by Blue Client.

Notes

The server hostname can be a domain or IP address, be it IPv4 or IPv6 address.

If the port is not specified, Lacewing Relay's default port 6121 will be used.


Here are some examples you can connect to:

  • "server1.dark-wire.com" – only the server host name is specified, default port 6121 will be used.
  • "server2.dark-wire.com:6122" – both the server host name and port are specified, connection will occur on port 6122.


If you are hosting a server on the same machine your client application is running on, you can connect to use IP "127.0.0.1", or "localhost".

  • "127.0.0.1" – same machine as app, default port 6121 will be used.
  • "localhost" – same machine as app, default port 6121 will be used.


There are free public servers for use that you can connect to here.

Feel free to read the Security topic to secure your apps on a public server, but unless you're transmitting private information or starting to publish a game, you aren't in a danger zone yet.