class_websocketmultiplayerpeer.rst 4.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/3.6/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/3.6/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml.
  6. .. _class_WebSocketMultiplayerPeer:
  7. WebSocketMultiplayerPeer
  8. ========================
  9. **Inherits:** :ref:`NetworkedMultiplayerPeer<class_NetworkedMultiplayerPeer>` **<** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`WebSocketClient<class_WebSocketClient>`, :ref:`WebSocketServer<class_WebSocketServer>`
  11. Base class for WebSocket server and client.
  12. .. rst-class:: classref-introduction-group
  13. Description
  14. -----------
  15. Base class for WebSocket server and client, allowing them to be used as network peer for the :ref:`MultiplayerAPI<class_MultiplayerAPI>`.
  16. .. rst-class:: classref-reftable-group
  17. Methods
  18. -------
  19. .. table::
  20. :widths: auto
  21. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | :ref:`WebSocketPeer<class_WebSocketPeer>` | :ref:`get_peer<class_WebSocketMultiplayerPeer_method_get_peer>` **(** :ref:`int<class_int>` peer_id **)** |const| |
  23. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | :ref:`Error<enum_@GlobalScope_Error>` | :ref:`set_buffers<class_WebSocketMultiplayerPeer_method_set_buffers>` **(** :ref:`int<class_int>` input_buffer_size_kb, :ref:`int<class_int>` input_max_packets, :ref:`int<class_int>` output_buffer_size_kb, :ref:`int<class_int>` output_max_packets **)** |
  25. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. .. rst-class:: classref-section-separator
  27. ----
  28. .. rst-class:: classref-descriptions-group
  29. Signals
  30. -------
  31. .. _class_WebSocketMultiplayerPeer_signal_peer_packet:
  32. .. rst-class:: classref-signal
  33. **peer_packet** **(** :ref:`int<class_int>` peer_source **)**
  34. Emitted when a packet is received from a peer.
  35. \ **Note:** This signal is only emitted when the client or server is configured to use Godot multiplayer API.
  36. .. rst-class:: classref-section-separator
  37. ----
  38. .. rst-class:: classref-descriptions-group
  39. Method Descriptions
  40. -------------------
  41. .. _class_WebSocketMultiplayerPeer_method_get_peer:
  42. .. rst-class:: classref-method
  43. :ref:`WebSocketPeer<class_WebSocketPeer>` **get_peer** **(** :ref:`int<class_int>` peer_id **)** |const|
  44. Returns the :ref:`WebSocketPeer<class_WebSocketPeer>` associated to the given ``peer_id``.
  45. .. rst-class:: classref-item-separator
  46. ----
  47. .. _class_WebSocketMultiplayerPeer_method_set_buffers:
  48. .. rst-class:: classref-method
  49. :ref:`Error<enum_@GlobalScope_Error>` **set_buffers** **(** :ref:`int<class_int>` input_buffer_size_kb, :ref:`int<class_int>` input_max_packets, :ref:`int<class_int>` output_buffer_size_kb, :ref:`int<class_int>` output_max_packets **)**
  50. Configures the buffer sizes for this WebSocket peer. Default values can be specified in the Project Settings under ``network/limits``. For server, values are meant per connected peer.
  51. The first two parameters define the size and queued packets limits of the input buffer, the last two of the output buffer.
  52. Buffer sizes are expressed in KiB, so ``4 = 2^12 = 4096 bytes``. All parameters will be rounded up to the nearest power of two.
  53. \ **Note:** HTML5 exports only use the input buffer since the output one is managed by browsers.
  54. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  55. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  56. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  57. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`