0 votes

Hi,

I was wondering while practicing websokcet
is there way to get connected websocket peers id directly?

full code link: Server.gd

....
var list_user:Array

var wss:WebSocketServer
....
func user_join(id,proto):
  list_user.append(id)
  send_all(('userJoin: '+str(id)).to_utf8())

func _leave(id,code,reason="No reason"):
  list_user.erase(id)
  send_all(('userOut: '+str(id)).to_utf8())
....

code works fine
just wonder, if there is better way :)

asked May 29 in Engine by liss22 (32 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.