Proofread and improve the whole class reference
- Document a few more properties and methods - Add more information to many classes - Fix lots of typos and gramar mistakes - Use [code] tags for parameters consistently - Use [b] and [i] tags consistently - Put "Warning:" and "Note:" on their own line to be more visible, and make them always bold - Tweak formatting in code examples to be more readable - Use double quotes consistently - Add more links to third-party technologies
This commit is contained in:
parent
538c8eec15
commit
f7f6115f76
330 changed files with 2585 additions and 2474 deletions
|
|
@ -1,13 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="WebSocketClient" inherits="WebSocketMultiplayerPeer" category="Core" version="3.2">
|
||||
<brief_description>
|
||||
A WebSocket client implementation
|
||||
A WebSocket client implementation.
|
||||
</brief_description>
|
||||
<description>
|
||||
This class implements a WebSocket client compatible with any RFC 6455 complaint WebSocket server.
|
||||
This class implements a WebSocket client compatible with any RFC 6455-compliant WebSocket server.
|
||||
This client can be optionally used as a network peer for the [MultiplayerAPI].
|
||||
After starting the client ([method connect_to_url]), you will need to [method NetworkedMultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]).
|
||||
You will received appropriate signals when connecting, disconnecting, or when new data is available.
|
||||
You will receive appropriate signals when connecting, disconnecting, or when new data is available.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
@ -22,8 +22,8 @@
|
|||
<argument index="2" name="gd_mp_api" type="bool" default="false">
|
||||
</argument>
|
||||
<description>
|
||||
Connect to the given URL requesting one of the given [code]protocols[/code] as sub-protocol.
|
||||
If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI], connections to non Godot servers will not work, and [signal data_received] will not be emitted.
|
||||
Connects to the given URL requesting one of the given [code]protocols[/code] as sub-protocol.
|
||||
If [code]true[/code] is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI], connections to non-Godot servers 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(1)[/code] and not on this object directly (e.g. [code]get_peer(1).put_packet(data)[/code]).
|
||||
</description>
|
||||
</method>
|
||||
|
|
@ -35,13 +35,14 @@
|
|||
<argument index="1" name="reason" type="String" default="""">
|
||||
</argument>
|
||||
<description>
|
||||
Disconnect this client from the connected host. See [method WebSocketPeer.close] for more info.
|
||||
Disconnects this client from the connected host. See [method WebSocketPeer.close] for more information.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="verify_ssl" type="bool" setter="set_verify_ssl_enabled" getter="is_verify_ssl_enabled">
|
||||
Enable or disable SSL certificate verification. Note: You must specify the certificates to be used in the project settings for it to work when exported.
|
||||
If [code]true[/code], SSL certificate verification is enabled.
|
||||
[b]Note:[/b] You must specify the certificates to be used in the Project Settings for it to work when exported.
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
|
|
@ -66,7 +67,8 @@
|
|||
</signal>
|
||||
<signal name="data_received">
|
||||
<description>
|
||||
Emitted when a WebSocket message is received. Note: This signal is NOT emitted when used as high level multiplayer peer.
|
||||
Emitted when a WebSocket message is received.
|
||||
[b]Note:[/b] This signal is [i]not[/i] emitted when used as high-level multiplayer peer.
|
||||
</description>
|
||||
</signal>
|
||||
<signal name="server_close_request">
|
||||
|
|
|
|||
|
|
@ -30,10 +30,10 @@
|
|||
<argument index="3" name="output_max_packets" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Configure the buffers sizes for this WebSocket peer. Default values can be specified in project settings under [code]network/limits[/code]. For server, values are meant per connected peer.
|
||||
Configures the buffer sizes for this WebSocket peer. Default values can be specified in the Project Settings under [code]network/limits[/code]. For server, values are meant per connected peer.
|
||||
The first two parameters define the size and queued packets limits of the input buffer, the last two of the output buffer.
|
||||
Buffer sizes are expressed in KiB, so [code]4 = 2^12 = 4096 bytes[/code]. All parameters will be rounded up to the nearest power of two.
|
||||
NOTE: HTML5 exports only use the input buffer since the output one is managed by browsers.
|
||||
[b]Note:[/b] HTML5 exports only use the input buffer since the output one is managed by browsers.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
@ -42,7 +42,8 @@
|
|||
<argument index="0" name="peer_source" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Emitted when a packet is received from a peer. Note: this signal is only emitted when the client or server is configured to use Godot multiplayer API.
|
||||
Emitted when a packet is received from a peer.
|
||||
[b]Note:[/b] This signal is only emitted when the client or server is configured to use Godot multiplayer API.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
|
|
|
|||
|
|
@ -18,30 +18,32 @@
|
|||
<argument index="1" name="reason" type="String" default="""">
|
||||
</argument>
|
||||
<description>
|
||||
Close this WebSocket connection. [code]code[/code] is the status code for the closure (see RFC6455 section 7.4 for a list of valid status codes). [code]reason[/code] is the human readable reason for closing the connection (can be any UTF8 string, must be less than 123 bytes).
|
||||
Note: To achieve a clean close, you will need to keep polling until either [signal WebSocketClient.connection_closed] or [signal WebSocketServer.client_disconnected] is received.
|
||||
Note: HTML5 export might not support all status codes. Please refer to browsers-specific documentation for more details.
|
||||
Closes this WebSocket connection. [code]code[/code] is the status code for the closure (see RFC 6455 section 7.4 for a list of valid status codes). [code]reason[/code] is the human readable reason for closing the connection (can be any UTF-8 string that's smaller than 123 bytes).
|
||||
[b]Note:[/b] To achieve a clean close, you will need to keep polling until either [signal WebSocketClient.connection_closed] or [signal WebSocketServer.client_disconnected] is received.
|
||||
[b]Note:[/b] The HTML5 export might not support all status codes. Please refer to browser-specific documentation for more details.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connected_host" qualifiers="const">
|
||||
<return type="String">
|
||||
</return>
|
||||
<description>
|
||||
Returns the IP Address of the connected peer. (Not available in HTML5 export)
|
||||
Returns the IP address of the connected peer.
|
||||
[b]Note:[/b] Not available in the HTML5 export.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_connected_port" qualifiers="const">
|
||||
<return type="int">
|
||||
</return>
|
||||
<description>
|
||||
Returns the remote port of the connected peer. (Not available in HTML5 export)
|
||||
Returns the remote port of the connected peer.
|
||||
[b]Note:[/b] Not available in the HTML5 export.
|
||||
</description>
|
||||
</method>
|
||||
<method name="get_write_mode" qualifiers="const">
|
||||
<return type="int" enum="WebSocketPeer.WriteMode">
|
||||
</return>
|
||||
<description>
|
||||
Get the current selected write mode. See [enum WriteMode].
|
||||
Gets the current selected write mode. See [enum WriteMode].
|
||||
</description>
|
||||
</method>
|
||||
<method name="is_connected_to_host" qualifiers="const">
|
||||
|
|
@ -70,10 +72,10 @@
|
|||
</methods>
|
||||
<constants>
|
||||
<constant name="WRITE_MODE_TEXT" value="0" enum="WriteMode">
|
||||
Specify that WebSockets messages should be transferred as text payload (only valid UTF-8 is allowed).
|
||||
Specifies that WebSockets messages should be transferred as text payload (only valid UTF-8 is allowed).
|
||||
</constant>
|
||||
<constant name="WRITE_MODE_BINARY" value="1" enum="WriteMode">
|
||||
Specify that WebSockets messages should be transferred as binary payload (any byte combination is allowed).
|
||||
Specifies that WebSockets messages should be transferred as binary payload (any byte combination is allowed).
|
||||
</constant>
|
||||
</constants>
|
||||
</class>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<class name="WebSocketServer" inherits="WebSocketMultiplayerPeer" category="Core" version="3.2">
|
||||
<brief_description>
|
||||
A WebSocket server implementation
|
||||
A WebSocket server implementation.
|
||||
</brief_description>
|
||||
<description>
|
||||
This class implements a WebSocket server that can also support the high level multiplayer API.
|
||||
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.
|
||||
Note: This class will not work in HTML5 exports due to browser restrictions.
|
||||
[b]Note:[/b] This class will not work in HTML5 exports due to browser restrictions.
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
<argument index="2" name="reason" type="String" default="""">
|
||||
</argument>
|
||||
<description>
|
||||
Disconnects the peer identified by [code]id[/code] from the server. See [method WebSocketPeer.close] for more info.
|
||||
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">
|
||||
|
|
@ -68,9 +68,9 @@
|
|||
<argument index="2" name="gd_mp_api" type="bool" default="false">
|
||||
</argument>
|
||||
<description>
|
||||
Start listening on the given port.
|
||||
Starts listening on the given port.
|
||||
You can specify the desired subprotocols via the "protocols" array. If the list empty (default), "binary" will be used.
|
||||
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 network 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>
|
||||
|
|
@ -78,7 +78,7 @@
|
|||
<return type="void">
|
||||
</return>
|
||||
<description>
|
||||
Stop the server and clear its state.
|
||||
Stops the server and clear its state.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
@ -116,7 +116,8 @@
|
|||
<argument index="0" name="id" type="int">
|
||||
</argument>
|
||||
<description>
|
||||
Emitted when a new message is received. Note: This signal is NOT emitted when used as high level multiplayer peer.
|
||||
Emitted when a new message is received.
|
||||
[b]Note:[/b] This signal is [i]not[/i] emitted when used as high-level multiplayer peer.
|
||||
</description>
|
||||
</signal>
|
||||
</signals>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue