summaryrefslogtreecommitdiff
path: root/modules/websocket/doc_classes/WebSocketServer.xml
diff options
context:
space:
mode:
Diffstat (limited to 'modules/websocket/doc_classes/WebSocketServer.xml')
-rw-r--r--modules/websocket/doc_classes/WebSocketServer.xml83
1 files changed, 32 insertions, 51 deletions
diff --git a/modules/websocket/doc_classes/WebSocketServer.xml b/modules/websocket/doc_classes/WebSocketServer.xml
index f7805209e2..b66a1054ab 100644
--- a/modules/websocket/doc_classes/WebSocketServer.xml
+++ b/modules/websocket/doc_classes/WebSocketServer.xml
@@ -5,78 +5,62 @@
</brief_description>
<description>
This class implements a WebSocket server that can also support the high-level multiplayer API.
- After starting the server ([method listen]), you will need to [method NetworkedMultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]). When clients connect, disconnect, or send data, you will receive the appropriate signal.
+ After starting the server ([method listen]), you will need to [method MultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]). When clients connect, disconnect, or send data, you will receive the appropriate signal.
[b]Note:[/b] Not available in HTML5 exports.
</description>
<tutorials>
</tutorials>
<methods>
<method name="disconnect_peer">
- <return type="void">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
- <argument index="1" name="code" type="int" default="1000">
- </argument>
- <argument index="2" name="reason" type="String" default="&quot;&quot;">
- </argument>
+ <return type="void" />
+ <argument index="0" name="id" type="int" />
+ <argument index="1" name="code" type="int" default="1000" />
+ <argument index="2" name="reason" type="String" default="&quot;&quot;" />
<description>
Disconnects the peer identified by [code]id[/code] from the server. See [method WebSocketPeer.close] for more information.
</description>
</method>
<method name="get_peer_address" qualifiers="const">
- <return type="String">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
+ <return type="String" />
+ <argument index="0" name="id" type="int" />
<description>
Returns the IP address of the given peer.
</description>
</method>
<method name="get_peer_port" qualifiers="const">
- <return type="int">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
+ <return type="int" />
+ <argument index="0" name="id" type="int" />
<description>
Returns the remote port of the given peer.
</description>
</method>
<method name="has_peer" qualifiers="const">
- <return type="bool">
- </return>
- <argument index="0" name="id" type="int">
- </argument>
+ <return type="bool" />
+ <argument index="0" name="id" type="int" />
<description>
Returns [code]true[/code] if a peer with the given ID is connected.
</description>
</method>
<method name="is_listening" qualifiers="const">
- <return type="bool">
- </return>
+ <return type="bool" />
<description>
Returns [code]true[/code] if the server is actively listening on a port.
</description>
</method>
<method name="listen">
- <return type="int" enum="Error">
- </return>
- <argument index="0" name="port" type="int">
- </argument>
- <argument index="1" name="protocols" type="PackedStringArray" default="PackedStringArray( )">
- </argument>
- <argument index="2" name="gd_mp_api" type="bool" default="false">
- </argument>
+ <return type="int" enum="Error" />
+ <argument index="0" name="port" type="int" />
+ <argument index="1" name="protocols" type="PackedStringArray" default="PackedStringArray()" />
+ <argument index="2" name="gd_mp_api" type="bool" default="false" />
<description>
Starts listening on the given port.
You can specify the desired subprotocols via the "protocols" array. If the list empty (default), no sub-protocol will be requested.
- If [code]true[/code] is passed as [code]gd_mp_api[/code], the server will behave like a network peer for the [MultiplayerAPI], connections from non-Godot clients will not work, and [signal data_received] will not be emitted.
+ If [code]true[/code] is passed as [code]gd_mp_api[/code], the server will behave like a multiplayer peer for the [MultiplayerAPI], connections from non-Godot clients will not work, and [signal data_received] will not be emitted.
If [code]false[/code] is passed instead (default), you must call [PacketPeer] functions ([code]put_packet[/code], [code]get_packet[/code], etc.), on the [WebSocketPeer] returned via [code]get_peer(id)[/code] to communicate with the peer with given [code]id[/code] (e.g. [code]get_peer(id).get_available_packet_count[/code]).
</description>
</method>
<method name="stop">
- <return type="void">
- </return>
+ <return type="void" />
<description>
Stops the server and clear its state.
</description>
@@ -89,6 +73,9 @@
<member name="ca_chain" type="X509Certificate" setter="set_ca_chain" getter="get_ca_chain">
When using SSL (see [member private_key] and [member ssl_certificate]), you can set this to a valid [X509Certificate] to be provided as additional CA chain information during the SSL handshake.
</member>
+ <member name="handshake_timeout" type="float" setter="set_handshake_timeout" getter="get_handshake_timeout" default="3.0">
+ The time in seconds before a pending client (i.e. a client that has not yet finished the HTTP handshake) is considered stale and forcefully disconnected.
+ </member>
<member name="private_key" type="CryptoKey" setter="set_private_key" getter="get_private_key">
When set to a valid [CryptoKey] (along with [member ssl_certificate]) will cause the server to require SSL instead of regular TCP (i.e. the [code]wss://[/code] protocol).
</member>
@@ -98,37 +85,31 @@
</members>
<signals>
<signal name="client_close_request">
- <argument index="0" name="id" type="int">
- </argument>
- <argument index="1" name="code" type="int">
- </argument>
- <argument index="2" name="reason" type="String">
- </argument>
+ <argument index="0" name="id" type="int" />
+ <argument index="1" name="code" type="int" />
+ <argument index="2" name="reason" type="String" />
<description>
Emitted when a client requests a clean close. You should keep polling until you get a [signal client_disconnected] signal with the same [code]id[/code] to achieve the clean close. See [method WebSocketPeer.close] for more details.
</description>
</signal>
<signal name="client_connected">
- <argument index="0" name="id" type="int">
- </argument>
- <argument index="1" name="protocol" type="String">
- </argument>
+ <argument index="0" name="id" type="int" />
+ <argument index="1" name="protocol" type="String" />
+ <argument index="2" name="resource_name" type="String" />
<description>
- Emitted when a new client connects. "protocol" will be the sub-protocol agreed with the client.
+ Emitted when a new client connects. "protocol" will be the sub-protocol agreed with the client, and "resource_name" will be the resource name of the URI the peer used.
+ "resource_name" is a path (at the very least a single forward slash) and potentially a query string.
</description>
</signal>
<signal name="client_disconnected">
- <argument index="0" name="id" type="int">
- </argument>
- <argument index="1" name="was_clean_close" type="bool">
- </argument>
+ <argument index="0" name="id" type="int" />
+ <argument index="1" name="was_clean_close" type="bool" />
<description>
Emitted when a client disconnects. [code]was_clean_close[/code] will be [code]true[/code] if the connection was shutdown cleanly.
</description>
</signal>
<signal name="data_received">
- <argument index="0" name="id" type="int">
- </argument>
+ <argument index="0" name="id" type="int" />
<description>
Emitted when a new message is received.
[b]Note:[/b] This signal is [i]not[/i] emitted when used as high-level multiplayer peer.