2018-02-19 10:47:16 +01:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-03-01 01:44:37 +01:00
<class name= "WebSocketMultiplayerPeer" inherits= "MultiplayerPeer" version= "4.1" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2018-02-19 10:47:16 +01:00
<brief_description >
2018-05-08 14:40:08 +02:00
Base class for WebSocket server and client.
2018-02-19 10:47:16 +01:00
</brief_description>
<description >
2021-09-07 23:35:19 +02:00
Base class for WebSocket server and client, allowing them to be used as multiplayer peer for the [MultiplayerAPI].
2021-08-10 17:47:09 +02:00
[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.
2018-02-19 10:47:16 +01:00
</description>
<tutorials >
</tutorials>
<methods >
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
<method name= "create_client" >
<return type= "int" enum= "Error" />
<param index= "0" name= "url" type= "String" />
2023-01-20 01:51:35 +01:00
<param index= "1" name= "tls_client_options" type= "TLSOptions" default= "null" />
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
<description >
2023-01-20 01:51:35 +01:00
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].
2023-02-03 12:33:17 +01:00
[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].
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
</description>
</method>
<method name= "create_server" >
<return type= "int" enum= "Error" />
<param index= "0" name= "port" type= "int" />
<param index= "1" name= "bind_address" type= "String" default= ""*"" />
2023-01-20 01:51:35 +01:00
<param index= "2" name= "tls_server_options" type= "TLSOptions" default= "null" />
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
<description >
2023-03-16 06:56:09 +01:00
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].
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
</description>
</method>
2018-02-19 10:47:16 +01:00
<method name= "get_peer" qualifiers= "const" >
2021-07-30 15:28:05 +02:00
<return type= "WebSocketPeer" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "peer_id" type= "int" />
2018-02-19 10:47:16 +01:00
<description >
2018-05-08 14:40:08 +02:00
Returns the [WebSocketPeer] associated to the given [code]peer_id[/code].
2018-02-19 10:47:16 +01:00
</description>
</method>
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
<method name= "get_peer_address" qualifiers= "const" >
<return type= "String" />
<param index= "0" name= "id" type= "int" />
2019-06-15 17:13:26 +02:00
<description >
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
Returns the IP address of the given peer.
2019-06-15 17:13:26 +02:00
</description>
</method>
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
<method name= "get_peer_port" qualifiers= "const" >
<return type= "int" />
<param index= "0" name= "id" type= "int" />
2018-02-19 10:47:16 +01:00
<description >
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
Returns the remote port of the given peer.
2018-02-19 10:47:16 +01:00
</description>
[WebSocket] Refactor websocket module.
This commit is a huge refactor of the websocket module.
The module is really old, and some design choices had to be
re-evaluated.
The WebSocketClient and WebSocketServer classes are now gone, and
WebSocketPeer can act as either client or server.
The WebSocketMultiplayerPeer class is no longer abstract, and implements
the Multiplayer API on top of the lower level WebSocketPeer.
WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS,
so it emits no signal, and just needs polling to update its internal
state.
To use it as a client, simply call WebSocketPeer.coonect_to_url, then
frequently poll the peer until STATE_OPEN is reached and then you can
write or read from it, or STATE_CLOSED and then you can check the
disconnect code and reason).
To implement a server instead, a TCPServer must be created, and the
accepted connections needs to be provided to
WebSocketPeer.accept_stream (which will perform the HTTP handshake).
A full example of a WebSocketServer using TLS will be provided in the
demo repository.
2022-09-24 22:44:44 +02:00
</method>
</methods>
<members >
<member name= "handshake_headers" type= "PackedStringArray" setter= "set_handshake_headers" getter= "get_handshake_headers" default= "PackedStringArray()" >
The extra headers to use during handshake. See [member WebSocketPeer.handshake_headers] for more details.
</member>
<member name= "handshake_timeout" type= "float" setter= "set_handshake_timeout" getter= "get_handshake_timeout" default= "3.0" >
The maximum time each peer can stay in a connecting state before being dropped.
</member>
<member name= "inbound_buffer_size" type= "int" setter= "set_inbound_buffer_size" getter= "get_inbound_buffer_size" default= "65535" >
The inbound buffer size for connected peers. See [member WebSocketPeer.inbound_buffer_size] for more details.
</member>
<member name= "max_queued_packets" type= "int" setter= "set_max_queued_packets" getter= "get_max_queued_packets" default= "2048" >
The maximum number of queued packets for connected peers. See [member WebSocketPeer.max_queued_packets] for more details.
</member>
<member name= "outbound_buffer_size" type= "int" setter= "set_outbound_buffer_size" getter= "get_outbound_buffer_size" default= "65535" >
The outbound buffer size for connected peers. See [member WebSocketPeer.outbound_buffer_size] for more details.
</member>
<member name= "supported_protocols" type= "PackedStringArray" setter= "set_supported_protocols" getter= "get_supported_protocols" default= "PackedStringArray()" >
The supported WebSocket sub-protocols. See [member WebSocketPeer.supported_protocols] for more details.
</member>
</members>
2018-02-19 10:47:16 +01:00
</class>