class_websocketmultiplayerpeer.rst 4.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/modules/websocket/doc_classes/WebSocketMultiplayerPeer.xml.
  6. .. _class_WebSocketMultiplayerPeer:
  7. WebSocketMultiplayerPeer
  8. ========================
  9. **Inherits:** :ref:`MultiplayerPeer<class_MultiplayerPeer>` **<** :ref:`PacketPeer<class_PacketPeer>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. **Inherited By:** :ref:`WebSocketClient<class_WebSocketClient>`, :ref:`WebSocketServer<class_WebSocketServer>`
  11. Base class for WebSocket server and client.
  12. Description
  13. -----------
  14. Base class for WebSocket server and client, allowing them to be used as multiplayer peer for the :ref:`MultiplayerAPI<class_MultiplayerAPI>`.
  15. \ **Note:** When exporting to Android, make sure to enable the ``INTERNET`` permission in the Android export preset before exporting the project or using one-click deploy. Otherwise, network communication of any kind will be blocked by Android.
  16. Methods
  17. -------
  18. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`WebSocketPeer<class_WebSocketPeer>` | :ref:`get_peer<class_WebSocketMultiplayerPeer_method_get_peer>` **(** :ref:`int<class_int>` peer_id **)** |const| |
  20. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :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 **)** |
  22. +-------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. Signals
  24. -------
  25. .. _class_WebSocketMultiplayerPeer_signal_peer_packet:
  26. - **peer_packet** **(** :ref:`int<class_int>` peer_source **)**
  27. Emitted when a packet is received from a peer.
  28. \ **Note:** This signal is only emitted when the client or server is configured to use Godot multiplayer API.
  29. Method Descriptions
  30. -------------------
  31. .. _class_WebSocketMultiplayerPeer_method_get_peer:
  32. - :ref:`WebSocketPeer<class_WebSocketPeer>` **get_peer** **(** :ref:`int<class_int>` peer_id **)** |const|
  33. Returns the :ref:`WebSocketPeer<class_WebSocketPeer>` associated to the given ``peer_id``.
  34. ----
  35. .. _class_WebSocketMultiplayerPeer_method_set_buffers:
  36. - :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 **)**
  37. 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.
  38. The first two parameters define the size and queued packets limits of the input buffer, the last two of the output buffer.
  39. Buffer sizes are expressed in KiB, so ``4 = 2^12 = 4096 bytes``. All parameters will be rounded up to the nearest power of two.
  40. \ **Note:** HTML5 exports only use the input buffer since the output one is managed by browsers.
  41. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  42. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  43. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  44. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  45. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  46. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`