godotengine / godotengine/godot

`WebSocketPeer.put_packet()` fails with no error printed when the socket is disconnected

Open
#99,747 1 comment 0 reactions 0 assignees View on GitHub
confirmed discussion topic:network
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in the 4.3-stable.

### System information

Ubuntu 22.04, 4.3-stable

### Issue description

WebSocketPeer.get_ready_state returns 1 when the socket is actually disconnected.
WebSocketPeer.put_packet puts packets into the void with no indication that something went wrong.

IIRC, this is not how websockets are supposed to work.

### Steps to reproduce

```gdscript
var socket = WebSocketPeer.new()
socket.connect_to_url(secure_url)
... wait for it to connect, then pull the cable
socket.poll()
socket.get_ready_state() # this returns 1
socket.put_packet(packet) # this doesn't report anything either
```

### Minimal reproduction project (MRP)

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.