Class reference

StreamPeerTLS

Inherits StreamPeer

A stream peer that handles TLS connections.

Description

A stream peer that handles TLS connections. This object can be used to connect to a TLS server or accept a single TLS client connection. Note: When exporting to Android, make sure to enable the INTERNET permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.

Methods

int connect_to_stream(StreamPeer stream, String common_name, TLSOptions client_options = null)

Connects to a peer using an underlying StreamPeer stream and verifying the remote certificate is correctly signed for the given common_name. You can pass the optional client_options parameter to customize the trusted certification authorities, or disable the common name verification. See TLSOptions.client() and TLSOptions.client_unsafe().

void disconnect_from_stream()

Disconnects from host.

int get_status() const

Returns the status of the connection.

Constants

STATUS_DISCONNECTED = 0

Enum: Status

A status representing a StreamPeerTLS that is disconnected.

STATUS_HANDSHAKING = 1

Enum: Status

A status representing a StreamPeerTLS during handshaking.

STATUS_CONNECTED = 2

Enum: Status

A status representing a StreamPeerTLS that is connected to a host.

STATUS_ERROR = 3

Enum: Status

A status representing a StreamPeerTLS in error state.

STATUS_ERROR_HOSTNAME_MISMATCH = 4

Enum: Status

An error status that shows a mismatch in the TLS certificate domain presented by the host and the domain requested for validation.

Tutorials

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.