blob: a1061e446b7bcdaabb3140ae54a8be3a31da6d9d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
<?xml version="1.0" encoding="UTF-8" ?>
<class name="WebSocketServer" inherits="WebSocketMultiplayerPeer" category="Core" version="3.1">
<brief_description>
A WebSocket server implementation
</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.
Note: This class will not work in HTML5 exports due to browser restrictions.
</description>
<tutorials>
</tutorials>
<demos>
</demos>
<methods>
<method name="disconnect_peer">
<return type="void">
</return>
<argument index="0" name="id" type="int">
</argument>
<description>
Disconnects the given peer.
</description>
</method>
<method name="get_peer_address" qualifiers="const">
<return type="String">
</return>
<argument index="0" name="id" type="int">
</argument>
<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>
<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>
<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>
<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="PoolStringArray" default="PoolStringArray( )">
</argument>
<argument index="2" name="gd_mp_api" type="bool" default="false">
</argument>
<description>
Start listening on the given port.
You can specify the desired subprotocols via the "protocols" array. If the list empty (default), "binary" will be used.
You can use this server as a network peer for [MultiplayerAPI] by passing true as "gd_mp_api". Note: [signal data_received] will not be fired and clients other than Godot will not work in this case.
</description>
</method>
<method name="stop">
<return type="void">
</return>
<description>
Stop the server and clear its state.
</description>
</method>
</methods>
<signals>
<signal name="client_connected">
<argument index="0" name="id" type="int">
</argument>
<argument index="1" name="protocol" type="String">
</argument>
<description>
Emitted when a new client connects. "protocol" will be the sub-protocol agreed with the client.
</description>
</signal>
<signal name="client_disconnected">
<argument index="0" name="id" type="int">
</argument>
<description>
Emitted when a client disconnects.
</description>
</signal>
<signal name="data_received">
<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.
</description>
</signal>
</signals>
<constants>
</constants>
</class>
|