I want to check if user already join the specific room before but got disconnected and from client the user login again and want to join room again the server need to reject the user if less than 1 hour.
in Room Extension :
Code: Select all
addEventHandler(SFSEventType.USER_JOIN_ROOM, event -> {
if(SomeCheckFunc()){
SFSErrorData errorData = new SFSErrorData(SFSErrorCode.JOIN_ROOM_LOCKED);
errorData.addParameter("Error bla bla bla");
throw new SFSJoinRoomException("error", errorData);
}
}
and in client :
Code: Select all
sfs.addEventListener(SFSEvent.ROOM_JOIN, evt -> {
showGameRoom();
});
sfs.addEventListener(SFSEvent.ROOM_JOIN_ERROR, evt -> {
System.out.println("Room joining failed: " + evt.getArguments().get("errorMessage"));
});
ROOM_JOIN_ERROR is NEVER called. Is there anyway add validation on server side and force trigger ROOM_JOIN_ERROR in client ?
I know I can create custom handle in server and in client listen to extension response before continue room join or not but this have 2 issue, first not secure since final validation logic in client and second it is not practice need two step in client and server.
please any suggestion/clue