-
Notifications
You must be signed in to change notification settings - Fork 102
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JoinById or JoinOrCreate... can not receive an exception when throw an exception from server #183
Comments
I am able to get the ServerError thrown from my colyseus backend. I am using UniTask as i want to build game for Webgl and Try-Catch do not work for webgl, now I can use Try-Catch on webgl too. Below is my sample code for both server and client side, to throw and to receive error. CLIENT END:
SERVER END:
|
Hi @deveshbeniwal, what would be the advantage of using Does it work without using UniTask? Cheers |
@endel Unitask is a customized package to use Tasks, Async-Await in a better way. I used UniTask here because i wanted to use async code with webgl builds, Webgl build do not support async programming and Try-Catch block too( usually it will throw an error at if we use try catch on webgl build from unity ).
Apart from that |
I think there is problem with
onAuth(client: Client, options: any, request?: IncomingMessage)
on the server side.When you return false or throw an exception in the
onAuth
method, on the Unity client side, at the first time, It will throw an exception, but when you join or create room one more time, It will not throw any exceptions. It only throw aWebsocket closed! Code:4002
, not an exception.Server side:
Unity client side:
Reproduce:
1: Client A create a room with a password.
2: Client B join to that room with a wrong password.
3: Client B have an onAuth exception => This is OK at the first time
4: Client B join to that room with a wrong password again.
5: Client B did not receive any exceptions again.
This is not only JoinById method, other methods like JoinOrCreate, Create.... also have this bug.
The text was updated successfully, but these errors were encountered: