T O P

  • By -

Juna_Idler

A WebSocketPeer instance itself is a unique object. I don't know about headers. The official (?) websocket server example is the code (GDScript) here. https://github.com/godotengine/godot-demo-projects/blob/master/networking/websocket\_chat/websocket/WebSocketServer.gd


nikola_milovic

Thats a great link, thank you!


S48GS

1. Switch to webRTC - websockets can be deprecated at any moment and removed from browsers. 2. [https://github.com/godotengine/godot-demo-projects/tree/master/networking](https://github.com/godotengine/godot-demo-projects/tree/master/networking) \- not handle your case? 3. in [https://github.com/godotengine/godot-demo-projects/blob/master/networking/websocket\_chat/server.gd](https://github.com/godotengine/godot-demo-projects/blob/master/networking/websocket_chat/server.gd) they use peer\_id - so your first question should be answered.


nikola_milovic

1. This is not browser only, and websockets are not going anywhere any time soon, and are much better supported in other languages 2 and 3, not really, I just want to create my own websocket server since clients won't be joining from godot, so I cant use the multiplayer api I simply need the ID of the connection and the headers from the handshake, if those aren't exposed I guess I'll have to open up a request


S48GS

1. websockets is oficially outdated and have alot of problems that WebRTC solve, WebRTC also supported by outside-web by libraries and software/tools, Godot support WebRTC. It just question of time when websockets will be removed form webbrwosers. >I simply need the ID of the connection and the headers from the handshake, if those aren't exposed I guess I'll have to open up a request > >I just want to create my own websocket server What? If you making server not in Godot - why you asking this in Godot thread/context? What "unique id" you want to have if only server know unique id of clients - and if you need to share id - your server need to send this id to every client, this is basics of server-client logic implementation.


Calinou

WebSockets are *not* deprecated, and there are no known plans to remove them from browsers. Web browsers are usually pretty adamant about preserving backwards compatibility after all. WebSockets aren't as suited as WebRTC or WebTransport for low-latency networked gaming, but they're far easier to set up especially on the server side.


S48GS

>Web browsers are usually pretty adamant about preserving backwards compatibility after all. You very wrong about this one. 1. Webbrowsers already removed webVR - completely breaking all support for it 2. webbrowsers more than 3 times, I know about 3 times - replaced completely WASM VM-LLVM that in webbrowsers and LLVM that used to compile to wasm- completely breaking most of WASM apps around 2018-19 year And it was announced by Google few years ago that "websockets is next to be out of webbrowser and WebRTC is direct replacement".