Click or drag to resize

WebSocketServerListen Method

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 true is passed as gd_mp_api, the server will behave like a network peer for the MultiplayerAPI, connections from non-Godot clients will not work, and data_received will not be emitted.

If false is passed instead (default), you must call PacketPeer functions (put_packet, get_packet, etc.), on the WebSocketPeer returned via get_peer(id) to communicate with the peer with given id (e.g. get_peer(id).get_available_packet_count).

Namespace:  Godot
Assembly:  GodotSharp (in GodotSharp.dll) Version: 1.0.0
Syntax
C#
public Error Listen(
	int port,
	string[] protocols = null,
	bool gdMpApi = false
)

Parameters

port
Type: SystemInt32

[Missing <param name="port"/> documentation for "M:Godot.WebSocketServer.Listen(System.Int32,System.String[],System.Boolean)"]

protocols (Optional)
Type: SystemString
If the parameter is null, then the default value is new string[] {}
gdMpApi (Optional)
Type: SystemBoolean

[Missing <param name="gdMpApi"/> documentation for "M:Godot.WebSocketServer.Listen(System.Int32,System.String[],System.Boolean)"]

Return Value

Type: Error

[Missing <returns> documentation for "M:Godot.WebSocketServer.Listen(System.Int32,System.String[],System.Boolean)"]

See Also