| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="WebSocketMultiplayerPeer" inherits="MultiplayerPeer" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> |
| 3 | <brief_description> |
| 4 | Base class for WebSocket server and client. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | Base class for WebSocket server and client, allowing them to be used as multiplayer peer for the [MultiplayerAPI]. |
| 8 | [b]Note:[/b] When exporting to Android, make sure to enable the [code]INTERNET[/code] 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. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | </tutorials> |
| 12 | <methods> |
| 13 | <method name="create_client"> |
| 14 | <return type="int" enum="Error" /> |
| 15 | <param index="0" name="url" type="String" /> |
| 16 | <param index="1" name="tls_client_options" type="TLSOptions" default="null" /> |
| 17 | <description> |
| 18 | Starts a new multiplayer client connecting to the given [param url]. TLS certificates will be verified against the hostname when connecting using the [code]wss://[/code] protocol. You can pass the optional [param tls_client_options] parameter to customize the trusted certification authorities, or disable the common name verification. See [method TLSOptions.client] and [method TLSOptions.client_unsafe]. |
| 19 | [b]Note:[/b] It is recommended to specify the scheme part of the URL, i.e. the [param url] should start with either [code]ws://[/code] or [code]wss://[/code]. |
| 20 | </description> |
| 21 | </method> |
| 22 | <method name="create_server"> |
| 23 | <return type="int" enum="Error" /> |
| 24 | <param index="0" name="port" type="int" /> |
| 25 | <param index="1" name="bind_address" type="String" default=""*"" /> |
| 26 | <param index="2" name="tls_server_options" type="TLSOptions" default="null" /> |
| 27 | <description> |
| 28 | Starts a new multiplayer server listening on the given [param port]. You can optionally specify a [param bind_address], and provide valid [param tls_server_options] to use TLS. See [method TLSOptions.server]. |
| 29 | </description> |
| 30 | </method> |
| 31 | <method name="get_peer" qualifiers="const"> |
| 32 | <return type="WebSocketPeer" /> |
| 33 | <param index="0" name="peer_id" type="int" /> |
| 34 | <description> |
| 35 | Returns the [WebSocketPeer] associated to the given [param peer_id]. |
| 36 | </description> |
| 37 | </method> |
| 38 | <method name="get_peer_address" qualifiers="const"> |
| 39 | <return type="String" /> |
| 40 | <param index="0" name="id" type="int" /> |
| 41 | <description> |
| 42 | Returns the IP address of the given peer. |
| 43 | </description> |
| 44 | </method> |
| 45 | <method name="get_peer_port" qualifiers="const"> |
| 46 | <return type="int" /> |
| 47 | <param index="0" name="id" type="int" /> |
| 48 | <description> |
| 49 | Returns the remote port of the given peer. |
| 50 | </description> |
| 51 | </method> |
| 52 | </methods> |
| 53 | <members> |
| 54 | <member name="handshake_headers" type="PackedStringArray" setter="set_handshake_headers" getter="get_handshake_headers" default="PackedStringArray()"> |
| 55 | The extra headers to use during handshake. See [member WebSocketPeer.handshake_headers] for more details. |
| 56 | </member> |
| 57 | <member name="handshake_timeout" type="float" setter="set_handshake_timeout" getter="get_handshake_timeout" default="3.0"> |
| 58 | The maximum time each peer can stay in a connecting state before being dropped. |
| 59 | </member> |
| 60 | <member name="inbound_buffer_size" type="int" setter="set_inbound_buffer_size" getter="get_inbound_buffer_size" default="65535"> |
| 61 | The inbound buffer size for connected peers. See [member WebSocketPeer.inbound_buffer_size] for more details. |
| 62 | </member> |
| 63 | <member name="max_queued_packets" type="int" setter="set_max_queued_packets" getter="get_max_queued_packets" default="4096"> |
| 64 | The maximum number of queued packets for connected peers. See [member WebSocketPeer.max_queued_packets] for more details. |
| 65 | </member> |
| 66 | <member name="outbound_buffer_size" type="int" setter="set_outbound_buffer_size" getter="get_outbound_buffer_size" default="65535"> |
| 67 | The outbound buffer size for connected peers. See [member WebSocketPeer.outbound_buffer_size] for more details. |
| 68 | </member> |
| 69 | <member name="supported_protocols" type="PackedStringArray" setter="set_supported_protocols" getter="get_supported_protocols" default="PackedStringArray()"> |
| 70 | The supported WebSocket sub-protocols. See [member WebSocketPeer.supported_protocols] for more details. |
| 71 | </member> |
| 72 | </members> |
| 73 | </class> |