diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-09-24 22:44:44 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2022-10-11 15:52:30 +0200 |
commit | a8950f98dd9809f5da370185d086d7027e14b76a (patch) | |
tree | 55869ca54bed9d1897a11d45baad1edea99081ac /doc/classes/GridContainer.xml | |
parent | 5aadc618b6ff152dbc0ca4ea901c34a97e164091 (diff) |
[WebSocket] Refactor websocket module.
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.
Diffstat (limited to 'doc/classes/GridContainer.xml')
0 files changed, 0 insertions, 0 deletions