Open adrianrz opened 5 years ago
It seems that you set 'auth' => true
in config/ratchet_client.php. If so, you must provide an authentication callback before running websocket.
Add this on your controller index function
$this->ratchet_client->set_callback('auth', array($this, '_auth'));
$this->ratchet_client->run();
And this function for authentication
public function _auth($datas = null)
{
// Here you can verify everything you want to perform user login.
// However, method must return integer (client ID) if auth succedeed and false if not.
return (!empty($datas->user_id)) ? $datas->user_id : false;
}
Ok, this auth can be for ex. ion_auth library?
Hello
You can define an auth function and do everything you wan't inside, otherwise you have to set the auth config => false, but not recommended
Thanks
Hi Roman, thanks for sharing your great work I just installed your library and when I run; php index.php welcome index It shows me an error: [31mAuthentication callback is required, you must set it before run server, aborting .. [0m I have experience in CI and followed the steps in detail. Any idea why it gives error? Regards