[MP] Add MultiplayerPeer disconnect_peer, close.

Update ENet, WebRTC, and WebSocket to support peer disconnection and
unify the close function.
This commit is contained in:
Fabio Alessandrelli
2022-10-22 17:49:40 +02:00
parent 028db9f2b5
commit 39f3d9d59e
13 changed files with 188 additions and 201 deletions

View File

@ -10,13 +10,6 @@
<tutorials>
</tutorials>
<methods>
<method name="close">
<return type="void" />
<description>
Closes this [MultiplayerPeer], resetting the state to [constant MultiplayerPeer.CONNECTION_CONNECTED].
[b]Note:[/b] To make sure remote peers receive a clean close prefer disconnecting clients via [method disconnect_peer].
</description>
</method>
<method name="create_client">
<return type="int" enum="Error" />
<param index="0" name="url" type="String" />
@ -37,15 +30,6 @@
Starts a new multiplayer server listening on the given [param port]. You can optionally specify a [param bind_address], and provide a [param tls_key] and [param tls_certificate] to use TLS.
</description>
</method>
<method name="disconnect_peer">
<return type="void" />
<param index="0" name="id" type="int" />
<param index="1" name="code" type="int" default="1000" />
<param 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" qualifiers="const">
<return type="WebSocketPeer" />
<param index="0" name="peer_id" type="int" />