summaryrefslogtreecommitdiffstats
path: root/modules/websocket
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* Style: Ensure consistent formatting with clang-format 15Rémi Verschelde2022-09-211-26/+24
| | | | | | | | | When going from version 14 to 15 it would introduce a tiny change in `websocket_macros.h` just before the comment re-enabling clang-format, but this can be solved by just letting it do its work. Bonus cosmetic change in `math_fieldwise.cpp` where clang-format isn't used, and bump recommended versions for pre-commit hook to [13; 15].
* [Net] Rename "ssl" references to "tls" in methods and members.Fabio Alessandrelli2022-09-0812-82/+82
|
* [Net] Rename StreamPeerSSL to StreamPeerTLS.Fabio Alessandrelli2022-09-074-13/+13
| | | | SSL has been deprectated almost 10 years ago.
* [Web] Rename JavaScript platform to Web.Fabio Alessandrelli2022-08-2918-43/+43
| | | | Also rename export name from "HTML5" to "Web".
* Rename the argument tag to param in XML documentationYuri Sizov2022-08-084-39/+39
|
* [Websocket] Remove dummy JS server implemenation.Fabio Alessandrelli2022-08-073-158/+3
| | | | | It does nothing but printing errors (only websocket client is available in browsers), so we might as well return null when you instantiate it.
* [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.Fabio Alessandrelli2022-07-261-1/+1
| | | | | | | | | - RPC configurations are now dictionaries. - Script.get_rpc_methods renamed to Script.get_rpc_config. - Node.rpc[_id] and Callable.rpc now return an Error. - Refactor MultiplayerAPI to allow extension. - New MultiplayerAPI.rpc method with Array argument (for scripts). - Move the default MultiplayerAPI implementation to a module.
* Code quality: Fix header guards consistencyRémi Verschelde2022-07-258-24/+25
| | | | | Adds `header_guards.sh` bash script, used in CI to validate future changes. Can be run locally to fix invalid header guards.
* Replace most uses of Map by HashMapreduz2022-05-163-3/+3
| | | | | | | | | | | | * Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
* [WebSocket] Fix WSLClient connection status.Fabio Alessandrelli2022-05-042-8/+7
| | | | | | | Note, this keeps the old behaviour of reporting CONNECTION_CONNECTED while disconnecting. We should change this before 4.0, but needs further refactoring of the WebSocket classes.
* Refactor module initializationreduz2022-05-042-15/+25
| | | | | | | * Changed to use the same stages as extensions. * Makes the initialization more coherent, helping solve problems due to lack of stages. * Makes it easier to port between module and extension. * removed the DRIVER initialization level (no longer needed).
* Merge pull request #60444 from snailrhymer/expand-websocketclient-error-messagesFabio Alessandrelli2022-05-031-5/+9
|\ | | | | Add detail to some error messages in wsl_client
| * Add detail to some error messages in wsl_clientSnailRhymer2022-04-221-5/+9
| | | | | | | | Add messages, and add expected and actual values to other messages in _verify_headers for easier troubleshooting.
* | Style: Partially apply clang-tidy's `cppcoreguidelines-pro-type-member-init`Rémi Verschelde2022-05-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | Didn't commit all the changes where it wants to initialize a struct with `{}`. Should be reviewed in a separate PR. Option `IgnoreArrays` enabled for now to be conservative, can be disabled to see if it proposes more useful changes. Also fixed manually a handful of other missing initializations / moved some from constructors.
* | Merge pull request #59582 from Faless/net/4.x_tcp_explicit_pollRémi Verschelde2022-04-271-1/+2
|\ \ | |/ |/|
| * [Net] Drop is_connected_to_host for TCP and UDP.Fabio Alessandrelli2022-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | The UDP method is now called `is_socket_connected` to limit confusion with the actual host connection status which doesn't make sense in UDP. The TCP method is completly dropped, use get_status instead. The only one left is the WebSocketPeer one, which should be fine as is for now.
| * [Net] Make StreamPeerTCP::_poll_connection explicit.Fabio Alessandrelli2022-03-271-0/+1
| | | | | | | | | | | | No longer hacked into `get_status` and renamed to `poll`. The old `poll` (for *nix `poll`, win `select`) is now called `wait`.
* | Added set_extra_headers() to WebSocketServerOğuzhan Eroğlu2022-04-127-3/+25
| |
* | Fix some issues found by cppcheck.bruvzg2022-04-069-82/+82
| |
* | Modules: Don't build editor-specific classes in templatesRémi Verschelde2022-03-285-6/+20
|/ | | | | They're moved to an `editor` subfolder so that we can easily handle them separately.