summaryrefslogtreecommitdiffstats
path: root/modules/websocket/wsl_client.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [WebSocket] Refactor websocket module.Fabio Alessandrelli2022-10-111-407/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* [Net] Rename "ssl" references to "tls" in methods and members.Fabio Alessandrelli2022-09-081-16/+16
|
* [Net] Rename StreamPeerSSL to StreamPeerTLS.Fabio Alessandrelli2022-09-071-5/+5
| | | | SSL has been deprectated almost 10 years ago.
* [Web] Rename JavaScript platform to Web.Fabio Alessandrelli2022-08-291-2/+2
| | | | Also rename export name from "HTML5" to "Web".
* Replace most uses of Map by HashMapreduz2022-05-161-1/+1
| | | | | | | | | | | | * 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-041-6/+6
| | | | | | | 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.
* 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.
* | [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`.
* Fix typos with codespellRémi Verschelde2022-02-101-1/+1
| | | | | | | Using codespell 2.2-dev from current git. Added `misc/scripts/codespell.sh` to make it easier to run it once in a while and update the skip and ignore lists.
* [Net] Non-blocking WebSocket hostname resolution.Jordan Schidlowsky2022-02-051-19/+53
| | | | | | Hostname is now resolved during poll in WebSocketClient (wslay) to avoid blocking during connect. An attempt is still made to find the hostname in the resolver cache.
* Rename or refactor macros to avoid leading underscoresOmar Polo2022-01-201-7/+7
| | | | | These are not used consistently and some can conflict with system-specific defines. While here, also delete some unused macros.
* Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
| | | | Happy new year to the wonderful Godot community!
* Try other resolved IPs if one fails to connectHaoyu Qiu2021-08-301-6/+22
|
* [Net] Rename NetworkedMultiplayerPeer to MultiplayerPeer.Fabio Alessandrelli2021-07-121-1/+1
|
* [Net] Fix WebSocketClient path parsing.Fabio Alessandrelli2021-06-281-0/+1
| | | | | Recent changes to parse_url caused the client to make invalid HTTP requests if no path was specified.
* Rename `instance()`->`instantiate()` when it's a verbLightning_A2021-06-191-2/+2
|
* Rename `IP_Unix`, `IP_Address` and `TCP_Server` to remove underscoresHugo Locurcio2021-05-061-3/+3
|
* Initialize class/struct variables with default values in modules/Rafał Mikrut2021-02-081-5/+0
|
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-1/+1
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-10/+17
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-7/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Remove WebSocket defaults from project settings.Fabio Alessandrelli2020-05-121-4/+4
| | | | | Can be manually set, let's not pollute them further. Should also be done for WebRTC.
* Replace NULL with nullptrlupoDharkael2020-04-021-2/+2
|
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-1/+1
| | | | | | | | | | For us, it practically only changes the fact that `A<A<int>>` is now used instead of the C++03 compatible `A<A<int> >`. Note: clang-format 10+ changed the `Standard` arguments to fully specified `c++11`, `c++14`, etc. versions, but we can't use `c++17` now if we want to preserve compatibility with clang-format 8 and 9. `Cpp11` is still supported as deprecated alias for `Latest`.
* Disable Nagle's algorithm for WebSocket TCP.Fabio Alessandrelli2020-01-281-0/+1
| | | | | | This should greatly decrease latency for the most common use cases. A new function WebSocketPeer::set_no_delay will allow to configure it if so desired.
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* Trim protocol field from spaces in WS classes.Fabio Alessandrelli2019-10-161-2/+6
|
* Custom headers support in WebSocketClient.Fabio Alessandrelli2019-10-091-3/+7
| | | | | This commit also converts all PoolVector<String> parameters to `const Vector<String>` in both WebSocketServer and WebSocketClient.
* WebSocketClient can now use custom SSL certificateFabio Alessandrelli2019-10-091-1/+1
| | | | Via the `trusted_ssl_certificate` property.
* Re-implement WebSocket get host/port.Fabio Alessandrelli2019-10-091-2/+5
| | | | Was lost during library switch
* Replace last occurrences of 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG'Rémi Verschelde2019-08-171-15/+11
| | | | | | | | | | The last remaining ERR_EXPLAIN call is in FreeType code and makes sense as is (conditionally defines the error message). There are a few ERR_EXPLAINC calls for C-strings where String is not included which can stay as is to avoid adding additional _MSGC macros just for that. Part of #31244.
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in rest of 'modules/'Robin Hübner2019-08-121-24/+9
|
* Fix WebSocketClient crash when unref during signalFabio Alessandrelli2019-07-281-6/+6
| | | | | Always call disconnect before emitting signals, to avoid calling it on a freed object if the user decides to unreference it in a signal.
* Fix WebSocketClient consuming data during hanshakeFabio Alessandrelli2019-07-081-0/+1
| | | | | Was missing a break of the while loop on connection. This potentially caused early data frames to be trashed.
* Optimize header reads (avoid extra allocs)Fabio Alessandrelli2019-07-041-19/+25
|
* WebSocket module now uses wslay library.Fabio Alessandrelli2019-07-041-0/+356
Both client and server are supported on native builds (as usual). SSL server is still not supported, but will soon be possible with this new library. The API stays the same, we just need to work out potential issues due to this big library switch.