summaryrefslogtreecommitdiffstats
path: root/modules/websocket
Commit message (Collapse)AuthorAgeFilesLines
* [WS] Implement wslay unbuffered message parsingFabio Alessandrelli2024-11-126-17/+72
| | | | | | | Ensure we never read more than we can store during poll. Raise default max packets to 4096 to maintain the same performance for the first 2048 packets.
* Merge pull request #97913 from Faless/fix/websocket_closing_transitionThaddeus Crews2024-11-121-6/+31
|\ | | | | | | [WS] Detect disconnection due to protocol errors
| * [WS] Detect disconnection due to protocol errorsFabio Alessandrelli2024-11-041-6/+31
| | | | | | | | | | | | | | | | | | | | | | When wslay receives a message that is too big or cause a protocol error, it automatically sends a close request to the remote peer but it also completely stop calling the receive callback resulting in the state being "stuck" as CONNECTED (even if both client and server have disconnected). We now check if we sent a close message and reading has been disabled to manually transition to the "closed" state with the proper reason.
* | [WebSocket] Add optional heartbeat via "ping" control frames.Fabio Alessandrelli2024-11-075-1/+53
|/ | | | | Has no effect in Web exports since the browsers do not expose a way to send ping control frames.
* Set clang-format `RemoveSemicolon` rule to `true`Adam Scott2024-10-252-2/+2
| | | | - Set clang-format `Standard` rule to `c++20`
* Parse fragment from URLHaoyu Qiu2024-09-273-4/+6
|
* SCons: Add unobtrusive type hints in SCons filesThaddeus Crews2024-09-251-0/+1
|
* Allow ClassDB to create a Object without postinitialization for GDExtension.Daylily-Zeleen2024-08-204-6/+6
|
* [WS] Fix set_no_delay on WindowsFabio Alessandrelli2024-08-071-2/+3
| | | | | | | | | | | Windows socket implementation is, as usual, broken in many ways. This includes `setsockopt` failing to set `TCP_NODELAY` if the socket is still in a connecting state. This also means we need to keep polling the IP resolver until the socket reaches the CONNECTED state (so it can set the TCP_NODELAY after the connection is successful).
* Merge pull request #94168 from Faless/net/wsl_peer_reuseRémi Verschelde2024-08-012-3/+5
|\ | | | | | | [WebSocket] Allow reusing closing and closed peers
| * [WebSocket] Allow reusing closing and closed peersFabio Alessandrelli2024-07-102-3/+5
| |
* | [WebSocket] Ensure TCP_NODELAY is always setFabio Alessandrelli2024-07-222-2/+3
|/ | | | | | | | | | | Almost all WebSocket implementations (including all major browsers) disable Nagle's algorithm to favor low latency over packet overhead. This was also the case in Godot 3.x, while in Godot 4.0 this was only being done for clients and wasn't even always working due to a bug. This commit fixes the aforementioned bug, and forces TCP_NODELAY when accepting a stream as a server.
* Reduce and prevent unnecessary random-access to `List`A Thousand Ships2024-05-041-2/+2
| | | | | | | | | Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element) * Removed subscript operator, in favor of a more explicit `get` * Added conversion from `Iterator` to `ConstIterator` * Remade existing operations into other solutions when applicable
* Enforce template syntax `typename` over `class`Thaddeus Crews2024-03-071-1/+1
|
* Replace error checks against `size` with `is_empty`A Thousand Ships2024-02-092-3/+3
|
* Merge pull request #79407 from zaevi/fix_web_websocket-close-reasonRémi Verschelde2023-10-131-1/+1
|\ | | | | | | [Web] Fix WebSocket returning empty close-reason.
| * [Web]Fix WebSocket returning empty close-reason.Zae2023-07-131-1/+1
| |
* | Add `proxy_to_pthread` option to `platform=web`Adam Scott2023-10-091-0/+5
| | | | | | | | Co-authored-by: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
* | [Modules] Replace `ERR_FAIL_COND` with `ERR_FAIL_NULL` where applicableA Thousand Ships2023-09-261-2/+2
| |
* | UWP: Remove platform port, needs to be redone from scratch for 4.xRémi Verschelde2023-09-071-1/+1
|/ | | | | | | | | | | The UWP platform port was never ported to the Godot 4.0+ API, and it's now accumulating bitrot as it doesn't compile, and thus we no longer propagate platform changes in it. So we finally remove to acknowledge this state. There's still some interest in reviving the UWP port eventually, especially as support for Direct3D 12 will soon be merged, but when that happens it will be easiest to redo it from scratch.
* Doctool: Remove version attribute from XML headerRémi Verschelde2023-07-062-2/+2
| | | | | | We don't use that info for anything, and it generates unnecessary diffs every time we bump the minor version (and CI failures if we forget to sync some files from opt-in modules (mono, text_server_fb).
* Bump version to 4.2-devRémi Verschelde2023-07-052-2/+2
| | | | Keep on waitin'
* Style: Harmonize header includes in modulesRémi Verschelde2023-06-158-21/+25
| | | | | | | | | | | | | | | | | | | | This applies our existing style guide, and adds a new rule to that style guide for modular components such as platform ports and modules: Includes from the platform port or module ("local" includes) should be listed first in their own block using relative paths, before Godot's "core" includes which use "absolute" (project folder relative) paths, and finally thirdparty includes. Includes in `#ifdef`s come after their relevant section, i.e. the overall structure is: - Local includes * Conditional local includes - Core includes * Conditional core includes - Thirdparty includes * Conditional thirdparty includes
* [TLS] Fix crashes trying to use TLS when not available.Fabio Alessandrelli2023-05-121-1/+3
| | | | | | | | | If no StreamPeerTLS implementation is available, HTTPClient and WebSocketPeer will now correctly refuse to connect using TLS returning ERR_UNAVAILABLE. Similarly, ENetConnection will refuse to setup DTLS when PacketPeerDTLS is not available.
* Validate code tags in documentation for potential paramsYuri Sizov2023-04-262-2/+2
| | | | | | | Adds a check to make_rst to look for matches between the text inside of the [code][/code] tag and known param identifiers. Fixes most of what was revealed.
* Fix misuses of error macrosDanil Alexeev2023-04-181-3/+0
|
* Fix typos and inconsistencies in classrefHaoyu Qiu2023-03-161-1/+1
|
* Bump version to 4.1-devRémi Verschelde2023-03-012-2/+2
| | | | Can't stop, won't stop, they said, huh?
* Fix WebSocketMultiplayerPeer server crashVsono2023-02-231-0/+1
|
* Document unsupported features in Mobile and Compatibility rendering methodsHugo Locurcio2023-02-131-1/+1
|
* Remove some unused signalsRémi Verschelde2023-01-311-1/+0
| | | | Part of #37604.
* [Net] Remove StreamPeerTLS.blocking_handshake option.Fabio Alessandrelli2023-01-281-1/+0
| | | | | | | | | Which was unused internally, and can be replaced by: ``` while tls.get_status() == tls.STATUS_HANDSHAKING: tls.poll() ```
* [NET] Refactor TLS configuration.Fabio Alessandrelli2023-01-2810-44/+37
| | | | | | | | | | | | | Use a TLSOptions configuration object which is created via static functions. - "TLSOptions.client": uses the standard CA and common name verification. - "TLSOptions.client_unsafe": uses optional CA verification (i.e. if specified) - "TLSOptions.server": is the standard server configuration (chain + key) This will allow us to expand the TLS configuration options to include e.g. mutual authentication without bloating the classes that uses StreamPeerTLS and PacketPeerDTLS as underlying peers.
* One Copyright Update to rule them allRémi Verschelde2023-01-0516-464/+464
| | | | | | | | | | | | | | | | | | | | As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
* Fix WebSocket connection failed on Web.Zae2022-11-031-0/+4
|
* Style: Misc docs and comment style and language fixesRémi Verschelde2022-11-021-1/+1
| | | | | | | | | | - Removed empty paragraphs in XML. - Consistently use bold style for "Example:", on a new line. - Fix usage of `[code]` when hyperlinks could be used (`[member]`, `[constant]`). - Fix invalid usage of backticks for inline code in BBCode. - Fix some American/British English spelling inconsistencies. - Other minor fixes spotted along the way, including typo fixes with codespell. - Don't specify `@GlobalScope` for `enum` and `constant`.
* [MP] Remove connection state signals from MultiplayerPeer.Fabio Alessandrelli2022-11-021-4/+1
| | | | Now handled directly by the MultiplayerAPI implementation.
* Merge pull request #67982 from Faless/mp/4.x_disconnect_closeFabio Alessandrelli2022-11-013-22/+11
|\ | | | | [MP] Add MultiplayerPeer disconnect_peer, close.
| * [MP] Add MultiplayerPeer disconnect_peer, close.Fabio Alessandrelli2022-10-283-22/+11
| | | | | | | | | | Update ENet, WebRTC, and WebSocket to support peer disconnection and unify the close function.
* | Merge pull request #67578 from KoBeWi/GEDITORRémi Verschelde2022-10-311-2/+2
|\ \ | |/ |/| | | Unify usage of GLOBAL/EDITOR_GET
| * Unify usage of GLOBAL/EDITOR_GETkobewi2022-10-181-2/+2
| |
* | [MP] Let MultiplayerAPI handle packet relaying and peer signaling.Fabio Alessandrelli2022-10-272-197/+75
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | MultiplayerPeer changes: - Adds is_server_relay_supported virtual method Informs the upper MultiplayerAPI layer if it can signal peers connected to the server to other clients, and perform packet relaying among them. - Adds get_packet_channel and get_packet_mode virtual methods Allows the MultiplayerAPI to retrieve the channel and transfer modes to use when relaying the last received packet. SceneMultiplayerPeer changes: - Implement peer signaling and packet relaying when the MultiplayerPeer advertise they are supported. ENet, WebRTC, WebSocket changes: - Removed custom code for relaying from WebSocket and ENet, and let it be handled by the upper layer. - Update WebRTC to split create_client, create_server, and create_mesh, with the latter behaving like the old initialize with "server_compatibility = false", and the first two supporting the upper layer relaying protocol.
* [WebSocket] Fix client failing to connect to direct IP.Fabio Alessandrelli2022-10-171-2/+4
| | | | | | | The bug was caused by not checking the TCP CONNECTING state appropriately during the client handshake, and not checking the TCP CONNECTED state during connection (which is unlikely, but might still happen).
* [WebSocket] Fix potential double free after multiplayer clear.Fabio Alessandrelli2022-10-131-0/+1
|
* [WebSocket] Fix debugger implementation.Fabio Alessandrelli2022-10-133-5/+19
| | | | | Register module during core initialization so the remote debugger can properly handle the "wss://" protocol.
* [WebSocket] Fix Web write mode.Fabio Alessandrelli2022-10-131-1/+1
|
* [WebSocket] Fix TCP connection being closed while connecting.Fabio Alessandrelli2022-10-131-0/+2
| | | | | Fix a bug causing the WebSocketPeer to fail connecting to a remote server when the TCP 3-way handshake took more than a few milliseconds.
* [WebSocket] Refactor websocket module.Fabio Alessandrelli2022-10-1129-2382/+1814
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is a huge refactor of the websocket module. The module is really old, and some design choices had to be re-evaluated. The WebSocketClient and WebSocketServer classes are now gone, and WebSocketPeer can act as either client or server. The WebSocketMultiplayerPeer class is no longer abstract, and implements the Multiplayer API on top of the lower level WebSocketPeer. WebSocketPeer is now a "raw" peer, like StreamPeerTCP and StreamPeerTLS, so it emits no signal, and just needs polling to update its internal state. To use it as a client, simply call WebSocketPeer.coonect_to_url, then frequently poll the peer until STATE_OPEN is reached and then you can write or read from it, or STATE_CLOSED and then you can check the disconnect code and reason). To implement a server instead, a TCPServer must be created, and the accepted connections needs to be provided to WebSocketPeer.accept_stream (which will perform the HTTP handshake). A full example of a WebSocketServer using TLS will be provided in the demo repository.
* Remove NO_THREADS fallback code, Godot 4 requires thread supportRémi Verschelde2022-10-031-0/+1
| | | | | This also removes `OS::can_use_threads` from the public API since it's always true.
* SCons: Unify tools/target build type configurationRémi Verschelde2022-09-261-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implements https://github.com/godotengine/godot-proposals/issues/3371. New `target` presets ==================== The `tools` option is removed and `target` changes to use three new presets, which match the builds users are familiar with. These targets control the default optimization level and enable editor-specific and debugging code: - `editor`: Replaces `tools=yes target=release_debug`. * Defines: `TOOLS_ENABLED`, `DEBUG_ENABLED`, `-O2`/`/O2` - `template_debug`: Replaces `tools=no target=release_debug`. * Defines: `DEBUG_ENABLED`, `-O2`/`/O2` - `template_release`: Replaces `tools=no target=release`. * Defines: `-O3`/`/O2` New `dev_build` option ====================== The previous `target=debug` is now replaced by a separate `dev_build=yes` option, which can be used in combination with either of the three targets, and changes the following: - `dev_build`: Defines `DEV_ENABLED`, disables optimization (`-O0`/`/0d`), enables generating debug symbols, does not define `NDEBUG` so `assert()` works in thirdparty libraries, adds a `.dev` suffix to the binary name. Note: Unlike previously, `dev_build` defaults to off so that users who compile Godot from source get an optimized and small build by default. Engine contributors should now set `dev_build=yes` in their build scripts or IDE configuration manually. Changed binary names ==================== The name of generated binaries and object files are changed too, to follow this format: `godot.<platform>.<target>[.dev][.double].<arch>[.<extra_suffix>][.<ext>]` For example: - `godot.linuxbsd.editor.dev.arm64` - `godot.windows.template_release.double.x86_64.mono.exe` Be sure to update your links/scripts/IDE config accordingly. More flexible `optimize` and `debug_symbols` options ==================================================== The optimization level and whether to generate debug symbols can be further specified with the `optimize` and `debug_symbols` options. So the default values listed above for the various `target` and `dev_build` combinations are indicative and can be replaced when compiling, e.g.: `scons p=linuxbsd target=template_debug dev_build=yes optimize=debug` will make a "debug" export template with dev-only code enabled, `-Og` optimization level for GCC/Clang, and debug symbols. Perfect for debugging complex crashes at runtime in an exported project.