, server returns an event ROOM_JOIN or ROOM_JOIN_ERROR. In case the room is full, we get an error message "Room demoRoom is full".My question: Why do we support a method which can check room is full for example:room.isFull() before we send request to join the room?

It is not reliable on the client side, because there is always the possibility that something changes during the time between the client sends his request and when it actually gets to the server.

Imagine a situation in which both User A and User B want to join Room 1, they both see that there is one player slot free, they both send the request at the same time. Only the server can resolve this situation, and it solves it by joining the User whose request got the server first.

That's why the error is thrown by the server and the client is not reliable in this sorts of things.