summaryrefslogtreecommitdiff
path: root/core/variant/variant_construct.cpp
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-09-24 22:44:44 +0200
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2022-10-11 15:52:30 +0200
commita8950f98dd9809f5da370185d086d7027e14b76a (patch)
tree55869ca54bed9d1897a11d45baad1edea99081ac /core/variant/variant_construct.cpp
parent5aadc618b6ff152dbc0ca4ea901c34a97e164091 (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 'core/variant/variant_construct.cpp')
0 files changed, 0 insertions, 0 deletions