WebSocketClient.xml 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="WebSocketClient" inherits="WebSocketMultiplayerPeer" category="Core" version="3.1">
  3. <brief_description>
  4. A WebSocket client implementation
  5. </brief_description>
  6. <description>
  7. This class implements a WebSocket client compatible with any RFC 6455 complaint WebSocket server.
  8. This client can be optionally used as a network peer for the [MultiplayerAPI].
  9. After starting the client ([method connect_to_url]), you will need to [method NetworkedMultiplayerPeer.poll] it at regular intervals (e.g. inside [method Node._process]).
  10. You will received appropriate signals when connecting, disconnecting, or when new data is available.
  11. </description>
  12. <tutorials>
  13. </tutorials>
  14. <demos>
  15. </demos>
  16. <methods>
  17. <method name="connect_to_url">
  18. <return type="int" enum="Error">
  19. </return>
  20. <argument index="0" name="url" type="String">
  21. </argument>
  22. <argument index="1" name="protocols" type="PoolStringArray" default="PoolStringArray( )">
  23. </argument>
  24. <argument index="2" name="gd_mp_api" type="bool" default="false">
  25. </argument>
  26. <description>
  27. Connect to the given URL requesting one of the given [code]protocols[/code] as sub-protocol.
  28. If [code]true[/code], is passed as [code]gd_mp_api[/code], the client will behave like a network peer for the [MultiplayerAPI]. Note: connections to non Godot servers will not work, and [signal data_received] will not be emitted when this option is true.
  29. </description>
  30. </method>
  31. <method name="disconnect_from_host">
  32. <return type="void">
  33. </return>
  34. <argument index="0" name="code" type="int" default="1000">
  35. </argument>
  36. <argument index="1" name="reason" type="String" default="&quot;&quot;">
  37. </argument>
  38. <description>
  39. Disconnect this client from the connected host. See [method WebSocketPeer.close] for more info.
  40. </description>
  41. </method>
  42. </methods>
  43. <members>
  44. <member name="verify_ssl" type="bool" setter="set_verify_ssl_enabled" getter="is_verify_ssl_enabled">
  45. Enable or disable SSL certificate verification. Note: You must specify the certificates to be used in the project settings for it to work when exported.
  46. </member>
  47. </members>
  48. <signals>
  49. <signal name="connection_closed">
  50. <argument index="0" name="was_clean_close" type="bool">
  51. </argument>
  52. <description>
  53. Emitted when the connection to the server is closed. [code]was_clean_close[/code] will be [code]true[/code] if the connection was shutdown cleanly.
  54. </description>
  55. </signal>
  56. <signal name="connection_error">
  57. <description>
  58. Emitted when the connection to the server fails.
  59. </description>
  60. </signal>
  61. <signal name="connection_established">
  62. <argument index="0" name="protocol" type="String">
  63. </argument>
  64. <description>
  65. Emitted when a connection with the server is established, [code]protocol[/code] will contain the sub-protocol agreed with the server.
  66. </description>
  67. </signal>
  68. <signal name="data_received">
  69. <description>
  70. Emitted when a WebSocket message is received. Note: This signal is NOT emitted when used as high level multiplayer peer.
  71. </description>
  72. </signal>
  73. <signal name="server_close_request">
  74. <argument index="0" name="code" type="int">
  75. </argument>
  76. <argument index="1" name="reason" type="String">
  77. </argument>
  78. <description>
  79. Emitted when the server requests a clean close. You should keep polling until you get a [signal connection_closed] signal to achieve the clean close. See [method WebSocketPeer.close] for more details.
  80. </description>
  81. </signal>
  82. </signals>
  83. <constants>
  84. </constants>
  85. </class>