How to emit and listen custom socket events.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By GOku99PRO

I have a web socket server where 8 players can send data and they are updating the field of play. So… When they go into a special area to fight i want that this 2 players in, to just listen their area socket events.

 const SERVER_STATUS = "server_status"; 
 function sendServerStatus(ws) {
	 let buffer = gdCom.putString(JSON.stringify({ data: players }));
	 ws.emit(SERVER_STATUS, players);

Godot Client

ws.connect(SERVER_STATUS, self, "_serverStatus")

func _serverStatus(response):

So is there any way to do this???
Emit from a server custom events an listen them with Godot WebSocketClient
Its like a classic behavior of rooms on a Socket.IO server