MrBin99 / LaravelEchoAndroid

Laravel Echo Android client
GNU General Public License v3.0
49 stars 22 forks source link

Trouble with catch Error Msg from Server in Android Client #12

Open Adham32 opened 5 years ago

Adham32 commented 5 years ago

Hi, we have got a problem. We try to connect to Laravel Echo Server, and all goes well. But the problem is, that our app not receive any Error (if access token is not valid). Laravel Echo server shows in console 401 error (like in screen below). App is still connected and does not receive any event like: "EVENT_ERROR", "EVENT_MESSAGE".. SERVER LOGS:

image

ANDROID CODE: Zrzut ekranu 2019-07-15 o 20 02 54

Any idea ? Can you help to us ? :) How to catch AuthenticationException form Laravel Echo Server in Android App. Kind Regards, AB.

jakub-adamski commented 5 years ago

.

MrBin99 commented 5 years ago

Hello. I don't know if you can catch this type of exception with the Echo client because it's an application error and not a "network error". My answer (but it may not be relevant for your app) is to not let the end user connect to a channel that you know he cannot access.

You can watch the JavaScript doc of Laravel Echo, my lib is working exactly the same way (I've just translated the JS code into Java).

I think the solution may be to add a callback here but I don't have enough time right now to investigate. Feel free to fork the repo and test it. If you find a solution, please tell me or do a pull request.

Thanks !