Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel websockets onclose

// Add websocket routes "AppProvidersRouteServiceProvider.php"
public function map()
{
    $this->mapApiRoutes();

    $this->mapWebRoutes();
  
    $this->app->singleton('websockets.router', function () {
        return new Router();
    });
}

// Create WebSocket Router "AppWebSocketsRoute.php"
class Router extends BeyondCodeLaravelWebSocketsServerRouter
{
    public function echo()
    {
        $this->get('/app/{appKey}', WebSocketHandler::class);
        $this->post('/apps/{appId}/events', TriggerEventController::class);
        $this->get('/apps/{appId}/channels', FetchChannelsController::class);
        $this->get('/apps/{appId}/channels/{channelName}', FetchChannelController::class);
        $this->get('/apps/{appId}/channels/{channelName}/users', FetchUsersController::class);
    }
}

// Create WebSocket Router "AppWebSocketsWebSocketHandler.php"
class WebSocketHandler extends BeyondCodeLaravelWebSocketsWebSocketsWebSocketHandler
{
    public function onClose(ConnectionInterface $connection, MessageInterface $message)
    {
        parent::onClose($connection, $message);
      	// Your code here...
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: flutter form autadjust height 
Php :: Too Many Attempts. laravel error 
Php :: if value conatins in word check in php 
Php :: Notice: Undefined property: enable_for_virtual 
Php :: floor ceil php 
Php :: laravel print query with parameters 
Php :: auth guard api is not defined laravel 8 
Php :: change php version in vagrant 
Php :: file_put_contents php json file 
Php :: laravel get session variable in controller 
Php :: delete all rows in table laravel 
Php :: laravel nginx permissions 
Php :: php validate date format 
Php :: how to exclude csrf in a route laravel 
Php :: how to take last entry in database in laravel Method ONe 
Php :: CodeIgniter get_where order_by 
Php :: laravel check if field has changed 
Php :: php factorial 
Php :: include a file in laravel controller 
Php :: pdo bindparam string 
Php :: laravel where update query 
Php :: lumen generate app key 
Php :: get name custom post type wordpress 
Php :: To store data in the session Laravel 
Php :: the action you have requested is not allowed. in codeigniter 
Php :: aravel 8 how to order by using eloquent orm 
Php :: a facade root has not been set laravel 
Php :: php get current date strtotime 
Php :: convert float to integer laravel 
Php :: php reduce 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =