godotengine / godot

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

WebSocketClient issue #34631

Closed zaksnet closed 4 years ago

zaksnet commented 4 years ago

PLATFORM Linux Mint 19.3 Godot 3.2 Beta 4

ISSUE I think something is broken with the WebSocketClient of Godot since i cant seem to be able to send any data to the server from my project. I also tested this with @Faless WebSocketChat demo and in that case the client just disconnects right after the connection is established. Some notes:

SAMPLE PROJECT WebSocketChat

Faless commented 4 years ago

What version of Godot are you running? I also see an error (red) in the debugger tab, would be nice if you could post the error too

zaksnet commented 4 years ago

What version of Godot are you running? I also see an error (red) in the debugger tab, would be nice if you could post the error too

Sorry forgot the mention the version :grimacing:, Its the latest Godot 3.2 Beta 4. I'm not sure about the error (probably some missing signal connection i had messed with) and i have deleted the test project folder so i cant test it :/. But i just tested with a fresh download of WebSocketChat and there is no error in the debugger tab but the issue remains.

Faless commented 4 years ago

@zaksnet can you run the project in verbose mode? (project -> project settings -> debug -> settings -> Verbose Stdout) and see if any socket error pops out in the output tab? Is it possible that port 8000 is already in use in your machine and the server fails to start?

I.e. : Can you try changing the listen and connect port to something else, e.g. 8082 (remember to change it in client connect row too)

zaksnet commented 4 years ago

Nope, no errors: image The server is running as far as i can tell and from my project i could connect using Simple websocket client. But now: image

zaksnet commented 4 years ago

Also, just noticed these: image

I'm not sure how to replicate these though :grimacing:

zaksnet commented 4 years ago

@Faless , the connection was refused because of the protocols. If i change them to an empty array it is fine. That brings us to my main issue with my project, let me see if i can replicate it with the chat application

zaksnet commented 4 years ago

Nope, 100% my fault. Messy code, everything works fine, sorry for the trouble!

As far as the WebSocketClient is concerned, just change: _client.connect_to_url(_host.text, PoolByteArray(), multiplayer) to _client.connect_to_url(_host.text, ["my-protocol"], multiplayer)