godotengine / godotengine/godot-docs

WebSocketPeer documentation contains no information on how to construct it

Open
#5,123 3 comments 0 reactions 0 assignees View on GitHub
area:class reference enhancement
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
3.3.2

**Issue description:**
I was trying to convert a program that connects to a server using `StreamPeerTCP` to one using WebSockets.

Unfortunately, while there is a `StreamPeerTCP.connect_to_server(host, port)` function, there is no equivalent function on a `WebSocketPeer` object.

It has taken me a very long time to work out (almost giving up) that the way to construct a clean websocket is through a different class, like so: `x = WebSocketClient.connect_to_url(gd_mp_api=false); websocket = x.get_peer(1)`

ie you construct it through the High-Level Multiplayer interface, but setting a flag to disable it!

I think there should be a note on the WebSocketPeer page pointing this out to make it easier to find.

**URL to the documentation page (if already existing):**
https://docs.godotengine.org/en/stable/classes/class_websocketpeer.html
https://docs.godotengine.org/en/stable/classes/class_streampeertcp.html

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.