#WebSocketPeer from WebSocketMultiplayerPeer

1 messages · Page 1 of 1 (latest)

grizzled flare
#

What peer_id do I use to get the WebSocketPeer after using create_server()?

wide parcel
#

you don't really get a WebSocketPeer object with a peer_id, peer_id is just used for calling RPCs, managing your state surrounding peers, and a few builtin functions that take it, i.e. disconnect_peer. Only the client that is that peer_id actually has that WebSocketPeer instantiated on their machine.

really what you want to do is keep a reference to the WebSocketPeer your created, i.e. with something like

var peer: WebSocketPeer

func _ready():
  peer = WebSocketPeer.new()

func _process(delta):
  # handle stuff like disconnects
  peer.disconnect_peer(some_id)