Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

First time connects normally, second time client connects but not receiving events #677

Closed
fzamperin opened this issue Jan 31, 2021 · 2 comments
Labels
help wanted Extra attention is needed network Issues caused by the network configuration

Comments

@fzamperin
Copy link

Hello, I'm having a problem with laravel-websockets, don't know if it's the server or the client, but here it goes:

I'm using an ionic capacitor mobile application with laravel-echo and pusher, when I first connect with the socket, everything works great, but in case of a disconnection or if I close the app and open again, It simply does not connect, the issue is even strange than that in the client side it says connect, and it receives ping and pong events and even has an socket id, but in the dashboard does not appear that the client has connected and if I try to send an event from the dashboard or Laravel application it does not work, It works in the following pattern: the first time it connects in a right way receives all events, after it connects the wrong way it says in the client that is connected, but it does not receives any event.

The second time connection can be anything, a disconnect, if I close the app from the background, anything, even with airplane mode.

Screen Shot 2021-01-31 at 15 13 05

This is already the second time I tried to connect, as you can see It connects the first time in a right way, than the second time does not show at the dashboard, as you can see I sent an event but it does not receives in the client.

This is the websocket inspect page for this second connect, as you can see it receives ping pong events, it does show that subscribed but it does not receives events:
Screen Shot 2021-01-31 at 15 13 12

Now with another disconnect and connect, as you can see it works flawlessly, I don't know why:
Screen Shot 2021-01-31 at 15 13 56

Client screenshot receiving the event (when connected the right way):
Screen Shot 2021-01-31 at 15 14 04

This is my pusher config from laravel, in the server, I can reproduce this in two differente apps, using the same server:

<?php

return [

    /*
    |--------------------------------------------------------------------------
    | Default Broadcaster
    |--------------------------------------------------------------------------
    |
    | This option controls the default broadcaster that will be used by the
    | framework when an event needs to be broadcast. You may set this to
    | any of the connections defined in the "connections" array below.
    |
    | Supported: "pusher", "redis", "log", "null"
    |
    */

    'default' => env('BROADCAST_DRIVER', 'pusher'),

    /*
    |--------------------------------------------------------------------------
    | Broadcast Connections
    |--------------------------------------------------------------------------
    |
    | Here you may define all of the broadcast connections that will be used
    | to broadcast events to other systems or over websockets. Samples of
    | each available type of connection are provided     inside this array.
    |
    */

    'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'), // Key
            'secret' => env('PUSHER_APP_SECRET'), // Secret
            'app_id' => env('PUSHER_APP_ID'), // An app ID
            'options' => [
                'cluster' => env('PUSHER_APP_CLUSTER'),// Here I put mt1
                'host' => 'websockets',
                'port' => 6001,
                'scheme' => 'http',
            ],
        ],

        'redis' => [
            'driver' => 'redis',
            'connection' => 'default',
        ],

        'log' => [
            'driver' => 'log',
        ],

        'null' => [
            'driver' => 'null',
        ],
    ],
];

If anyone has any guesses what I'm doing wrong, It would be really thankful. Thanks a lot for the team of laravel-websockets It is a really great job.

@simonbuehler
Copy link
Contributor

Do you have stale connections being closed when you terminate the websocket server?
You could test the redis backend and see if the problem is fixed there, the local Channelmanager seems to have a issue

@rennokki
Copy link
Collaborator

Perhaps this was fixed with #708?

@rennokki rennokki added help wanted Extra attention is needed network Issues caused by the network configuration labels Mar 30, 2021
@mpociot mpociot closed this as completed Feb 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted Extra attention is needed network Issues caused by the network configuration
Projects
None yet
Development

No branches or pull requests

4 participants