godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.13k stars 21.19k forks source link

WebSocketMultiplayerPeer does not emit signals as documented #48759

Closed tavurth closed 2 years ago

tavurth commented 3 years ago

Godot version:

Screenshot 2021-05-16 at 13 11 54

OS/device including version:

Screenshot 2021-05-16 at 13 12 04

Issue description: WebSocketClient and WebSocketServer do not emit signals as expected by the documentation.

There are no signals emitted on either the client or the server when the connection is established (but the connection works fine)

The server_close_request is the only signal which seems to be working on the client, I couldn't reproduce any signals working on the server.

Steps to reproduce: See sample project

godot-websocket-signals-master.zip

Workaround

For now I will be using the NetworkedMultiplayerPeer signals which seem to work correctly.

Faless commented 2 years ago

This is mostly a documentation issue. When using the multiplayer API (i.e. gd_mp_api=true) only the signals from NetworkedMultiplayerPeer works, the others for when one does not use the multiplayer API. We can of course change that if desired, but most of them will just be duplicate signals.

Faless commented 2 years ago

Additionally I was thinking of splitting the multiplayer part from the regular websocket peers like done for ENet (in 4.0 I mean).

Faless commented 2 years ago

Additionally I was thinking of splitting the multiplayer part from the regular websocket peers like done for ENet (in 4.0 I mean).

This is now done via https://github.com/godotengine/godot/pull/66594 (which basically resolves this issue in 4.0). We may still want to improve documentation for 3.x branch highlighting which event is fired in which mode.

Faless commented 2 years ago

Closing as fixed in the master branch, if anyone wants to contribute better documentation for the 3.x branch feel free to open a PR targeting that branch.