tlaverdure / laravel-echo-server

Socket.io server for Laravel Echo
MIT License
2.65k stars 511 forks source link

Realtime login after join presence #282

Open CihanAksoy opened 6 years ago

CihanAksoy commented 6 years ago

I have a real time login system and the auth function does not work after login.

if (data.isLoggedIn === true) { Echo.join('App.User.' + data.info.etk); }

i got "Client can not be authenticated" error message

bayareawebpro commented 6 years ago

Clients must be authenticated via broadcasting Routes. If you are using JS / API routes you will need to update your middleware array in Providers/BroadcastingServiceProvider.php to reflect that.

abetwothree commented 6 years ago

You must also hook into the Laravel log in system somehow since all Broadcast routes check to make sure the person trying to connect to a private or presence channel are logged in to the system. I ran into this. Check out this answer:

https://stackoverflow.com/a/45782726/5464316