godotengine / godotengine/godot-docs

`peer_disconnected` documentation does not mirror that of `peer_connected`

Open
#11,122 0 comments 0 reactions 0 assignees View on GitHub
area:class reference bug topic:network
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

**Your Godot version:**
v4.5.beta1.mono.official [46c495ca2]

**Issue description:**
The documentation for `peer_connected` and `peer_disconnected` is inconsistent. They both receive signals when the server (peer ID of 1) connects or disconnects, but it's only mentioned on `peer_connected`. Assuming a disconnect signal would be received because a connect signal is received may be efficient, but I did not make that assumption at first, hence this issue.

Here's a simple code example that just shows the signal connections. (This example does not show the other aspects of setting up networking)
```gdscript
func _ready() -> void:
multiplayer.peer_connected.connect(_on_peer_connected)
multiplayer.peer_disconnected.connect(_on_peer_disconnected)

func _on_peer_connected(id: int) -> void:
print("Peer connected: ", id)

func _on_peer_disconnected(id: int) -> void:
print("Peer disconnected: ", id)
```

Here is a screenshot of my client logs after starting the server, connecting a client, and stopping the server.

Image

**URL to the documentation page (if already existing):**
[MultiplayerAPI#peer_disconnected](https://docs.godotengine.org/en/latest/classes/class_multiplayerapi.html#class-multiplayerapi-signal-peer-disconnected)

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.