浏览代码

[WebSocket] Clarify that connect_to_url is non-blocking

Fabio Alessandrelli 9 月之前
父节点
当前提交
95401f0753
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      modules/websocket/doc_classes/WebSocketPeer.xml

+ 1 - 0
modules/websocket/doc_classes/WebSocketPeer.xml

@@ -61,6 +61,7 @@
 			<param index="1" name="tls_client_options" type="TLSOptions" default="null" />
 			<description>
 				Connects to the given 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].
+				[b]Note:[/b] This method is non-blocking, and will return [constant OK] before the connection is established as long as the provided parameters are valid and the peer is not in an invalid state (e.g. already connected). Regularly call [method poll] (e.g. during [Node] process) and check the result of [method get_ready_state] to know whether the connection succeeds or fails.
 				[b]Note:[/b] To avoid mixed content warnings or errors in Web, you may have to use a [param url] that starts with [code]wss://[/code] (secure) instead of [code]ws://[/code]. When doing so, make sure to use the fully qualified domain name that matches the one defined in the server's TLS certificate. Do not connect directly via the IP address for [code]wss://[/code] connections, as it won't match with the TLS certificate.
 			</description>
 		</method>