Hello Nikesh,
I guess after leaving the room, you are calling connect API, if so then you will get error code 4 as you are still connected to the server and trying to reconnect.
In this case, to join the room again call joinRoom API.
If this is not the case, please provide the steps which you are doing along with code snippets. It will help to debug the problem.
Thanks.