Laravel Broadcasting does't write to redis but direct call to redis works











up vote
0
down vote

favorite












I have tried sereval tuto to try to setup Laravel Redis NodeJs Socket.



And it'is not working.



So far :
- my broadcast fires as I can see it in Laravel log
- my redis server works (I have added a call to Redis in my homecontroller and I can see the value in the log and in redis-cli monitor - I have also installed Horizon and I can see its call in Redis-cli monitor)



But when my broadcast fires I don't see anything in redis-cli monitor



I have already tried the obvious things (cache/ config clear / reboot / ...)



Help will be very apreciated !



Redis call in my homecontroller : working



Redis::set("foo","bar");
$value = Redis::get("foo");
Log::debug('Redis value :'.$value);


.Env



LOG_CHANNEL=stack

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=siview
DB_USERNAME=root
DB_PASSWORD=


QUEUE_DRIVER=sync
QUEUE_CONNECTION=sync

CACHE_DRIVER=file

SESSION_DRIVER=file
SESSION_LIFETIME=120


BROADCAST_DRIVER=redis
REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"


Database.php



 'redis' => [
'client' => 'predis',

'default' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 0,
'read_write_timeout' => 60,
],

'cache' => [
'host' => env('REDIS_HOST', '127.0.0.1'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => env('REDIS_CACHE_DB', 1),
],

'pubsub' => [
'host' => env('REDIS_HOST', 'localhost'),
'password' => env('REDIS_PASSWORD', null),
'port' => env('REDIS_PORT', 6379),
'database' => 2,
],




],


Boadcasting.php



<?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', 'redis'),

/*
|--------------------------------------------------------------------------
| 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'),
'secret' => env('PUSHER_APP_SECRET'),
'app_id' => env('PUSHER_APP_ID'),
'options' => [
'cluster' => env('PUSHER_APP_CLUSTER'),
'encrypted' => true,
],
],

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

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

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

],

];


Event



<?php

namespace AppEvents;

use IlluminateBroadcastingChannel;
use IlluminateQueueSerializesModels;
use IlluminateBroadcastingPrivateChannel;
use IlluminateBroadcastingPresenceChannel;
use IlluminateFoundationEventsDispatchable;
use IlluminateBroadcastingInteractsWithSockets;
use IlluminateContractsBroadcastingShouldBroadcast;
use AppUser;


class SendMessageEvent implements ShouldBroadcast
{
use Dispatchable, InteractsWithSockets, SerializesModels;

private $user;

/**
* Create a new event instance.
*
* @return void
*/
public function __construct(User $user)
{
$this->user = $user;
}

/**
* Get the channels the event should broadcast on.
*
* @return IlluminateBroadcastingChannel|array
*/
public function broadcastOn()
{
return new PrivateChannel('App.User.' . $this->user->id);
}

public function broadcastWith()
{
return ['message' => 'Salut ' . $this->user->name];
}
}


Route Channel



<?php

/*
|--------------------------------------------------------------------------
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/

Broadcast::channel('App.User.{id}', function ($user, $id) {
return true;//(int) $user->id === (int) $id;
});


Route web



<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/


Auth::routes();

Route::get('/send/{user}', function(AppUser $user){

event(new AppEventsSendMessageEvent($user));

});

Route::get('/home', 'HomeController@index')->name('home');


Laravel.log showing my broascast



    [2018-11-04 09:39:42] local.INFO: Broadcasting [AppEventsSendMessageEvent] on channels [private-App.User.1] with payload:
{
"message": "Salut nathalie",
"socket": null
}


redis-cli monitor showing my homecontroller test



1541324518.159040 [0 127.0.0.1:59334] "SELECT" "0"
1541324518.159776 [0 127.0.0.1:59334] "SET" "foo" "bar"
1541324518.160360 [0 127.0.0.1:59334] "GET" "foo"









share|improve this question


























    up vote
    0
    down vote

    favorite












    I have tried sereval tuto to try to setup Laravel Redis NodeJs Socket.



    And it'is not working.



    So far :
    - my broadcast fires as I can see it in Laravel log
    - my redis server works (I have added a call to Redis in my homecontroller and I can see the value in the log and in redis-cli monitor - I have also installed Horizon and I can see its call in Redis-cli monitor)



    But when my broadcast fires I don't see anything in redis-cli monitor



    I have already tried the obvious things (cache/ config clear / reboot / ...)



    Help will be very apreciated !



    Redis call in my homecontroller : working



    Redis::set("foo","bar");
    $value = Redis::get("foo");
    Log::debug('Redis value :'.$value);


    .Env



    LOG_CHANNEL=stack

    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=siview
    DB_USERNAME=root
    DB_PASSWORD=


    QUEUE_DRIVER=sync
    QUEUE_CONNECTION=sync

    CACHE_DRIVER=file

    SESSION_DRIVER=file
    SESSION_LIFETIME=120


    BROADCAST_DRIVER=redis
    REDIS_HOST=127.0.0.1
    REDIS_PASSWORD=null
    REDIS_PORT=6379

    MAIL_DRIVER=smtp
    MAIL_HOST=smtp.mailtrap.io
    MAIL_PORT=2525
    MAIL_USERNAME=null
    MAIL_PASSWORD=null
    MAIL_ENCRYPTION=null

    PUSHER_APP_ID=
    PUSHER_APP_KEY=
    PUSHER_APP_SECRET=
    PUSHER_APP_CLUSTER=mt1

    MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
    MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"


    Database.php



     'redis' => [
    'client' => 'predis',

    'default' => [
    'host' => env('REDIS_HOST', 'localhost'),
    'password' => env('REDIS_PASSWORD', null),
    'port' => env('REDIS_PORT', 6379),
    'database' => 0,
    'read_write_timeout' => 60,
    ],

    'cache' => [
    'host' => env('REDIS_HOST', '127.0.0.1'),
    'password' => env('REDIS_PASSWORD', null),
    'port' => env('REDIS_PORT', 6379),
    'database' => env('REDIS_CACHE_DB', 1),
    ],

    'pubsub' => [
    'host' => env('REDIS_HOST', 'localhost'),
    'password' => env('REDIS_PASSWORD', null),
    'port' => env('REDIS_PORT', 6379),
    'database' => 2,
    ],




    ],


    Boadcasting.php



    <?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', 'redis'),

    /*
    |--------------------------------------------------------------------------
    | 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'),
    'secret' => env('PUSHER_APP_SECRET'),
    'app_id' => env('PUSHER_APP_ID'),
    'options' => [
    'cluster' => env('PUSHER_APP_CLUSTER'),
    'encrypted' => true,
    ],
    ],

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

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

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

    ],

    ];


    Event



    <?php

    namespace AppEvents;

    use IlluminateBroadcastingChannel;
    use IlluminateQueueSerializesModels;
    use IlluminateBroadcastingPrivateChannel;
    use IlluminateBroadcastingPresenceChannel;
    use IlluminateFoundationEventsDispatchable;
    use IlluminateBroadcastingInteractsWithSockets;
    use IlluminateContractsBroadcastingShouldBroadcast;
    use AppUser;


    class SendMessageEvent implements ShouldBroadcast
    {
    use Dispatchable, InteractsWithSockets, SerializesModels;

    private $user;

    /**
    * Create a new event instance.
    *
    * @return void
    */
    public function __construct(User $user)
    {
    $this->user = $user;
    }

    /**
    * Get the channels the event should broadcast on.
    *
    * @return IlluminateBroadcastingChannel|array
    */
    public function broadcastOn()
    {
    return new PrivateChannel('App.User.' . $this->user->id);
    }

    public function broadcastWith()
    {
    return ['message' => 'Salut ' . $this->user->name];
    }
    }


    Route Channel



    <?php

    /*
    |--------------------------------------------------------------------------
    | Broadcast Channels
    |--------------------------------------------------------------------------
    |
    | Here you may register all of the event broadcasting channels that your
    | application supports. The given channel authorization callbacks are
    | used to check if an authenticated user can listen to the channel.
    |
    */

    Broadcast::channel('App.User.{id}', function ($user, $id) {
    return true;//(int) $user->id === (int) $id;
    });


    Route web



    <?php

    /*
    |--------------------------------------------------------------------------
    | Web Routes
    |--------------------------------------------------------------------------
    |
    | Here is where you can register web routes for your application. These
    | routes are loaded by the RouteServiceProvider within a group which
    | contains the "web" middleware group. Now create something great!
    |
    */


    Auth::routes();

    Route::get('/send/{user}', function(AppUser $user){

    event(new AppEventsSendMessageEvent($user));

    });

    Route::get('/home', 'HomeController@index')->name('home');


    Laravel.log showing my broascast



        [2018-11-04 09:39:42] local.INFO: Broadcasting [AppEventsSendMessageEvent] on channels [private-App.User.1] with payload:
    {
    "message": "Salut nathalie",
    "socket": null
    }


    redis-cli monitor showing my homecontroller test



    1541324518.159040 [0 127.0.0.1:59334] "SELECT" "0"
    1541324518.159776 [0 127.0.0.1:59334] "SET" "foo" "bar"
    1541324518.160360 [0 127.0.0.1:59334] "GET" "foo"









    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have tried sereval tuto to try to setup Laravel Redis NodeJs Socket.



      And it'is not working.



      So far :
      - my broadcast fires as I can see it in Laravel log
      - my redis server works (I have added a call to Redis in my homecontroller and I can see the value in the log and in redis-cli monitor - I have also installed Horizon and I can see its call in Redis-cli monitor)



      But when my broadcast fires I don't see anything in redis-cli monitor



      I have already tried the obvious things (cache/ config clear / reboot / ...)



      Help will be very apreciated !



      Redis call in my homecontroller : working



      Redis::set("foo","bar");
      $value = Redis::get("foo");
      Log::debug('Redis value :'.$value);


      .Env



      LOG_CHANNEL=stack

      DB_CONNECTION=mysql
      DB_HOST=127.0.0.1
      DB_PORT=3306
      DB_DATABASE=siview
      DB_USERNAME=root
      DB_PASSWORD=


      QUEUE_DRIVER=sync
      QUEUE_CONNECTION=sync

      CACHE_DRIVER=file

      SESSION_DRIVER=file
      SESSION_LIFETIME=120


      BROADCAST_DRIVER=redis
      REDIS_HOST=127.0.0.1
      REDIS_PASSWORD=null
      REDIS_PORT=6379

      MAIL_DRIVER=smtp
      MAIL_HOST=smtp.mailtrap.io
      MAIL_PORT=2525
      MAIL_USERNAME=null
      MAIL_PASSWORD=null
      MAIL_ENCRYPTION=null

      PUSHER_APP_ID=
      PUSHER_APP_KEY=
      PUSHER_APP_SECRET=
      PUSHER_APP_CLUSTER=mt1

      MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
      MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"


      Database.php



       'redis' => [
      'client' => 'predis',

      'default' => [
      'host' => env('REDIS_HOST', 'localhost'),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => 0,
      'read_write_timeout' => 60,
      ],

      'cache' => [
      'host' => env('REDIS_HOST', '127.0.0.1'),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => env('REDIS_CACHE_DB', 1),
      ],

      'pubsub' => [
      'host' => env('REDIS_HOST', 'localhost'),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => 2,
      ],




      ],


      Boadcasting.php



      <?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', 'redis'),

      /*
      |--------------------------------------------------------------------------
      | 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'),
      'secret' => env('PUSHER_APP_SECRET'),
      'app_id' => env('PUSHER_APP_ID'),
      'options' => [
      'cluster' => env('PUSHER_APP_CLUSTER'),
      'encrypted' => true,
      ],
      ],

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

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

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

      ],

      ];


      Event



      <?php

      namespace AppEvents;

      use IlluminateBroadcastingChannel;
      use IlluminateQueueSerializesModels;
      use IlluminateBroadcastingPrivateChannel;
      use IlluminateBroadcastingPresenceChannel;
      use IlluminateFoundationEventsDispatchable;
      use IlluminateBroadcastingInteractsWithSockets;
      use IlluminateContractsBroadcastingShouldBroadcast;
      use AppUser;


      class SendMessageEvent implements ShouldBroadcast
      {
      use Dispatchable, InteractsWithSockets, SerializesModels;

      private $user;

      /**
      * Create a new event instance.
      *
      * @return void
      */
      public function __construct(User $user)
      {
      $this->user = $user;
      }

      /**
      * Get the channels the event should broadcast on.
      *
      * @return IlluminateBroadcastingChannel|array
      */
      public function broadcastOn()
      {
      return new PrivateChannel('App.User.' . $this->user->id);
      }

      public function broadcastWith()
      {
      return ['message' => 'Salut ' . $this->user->name];
      }
      }


      Route Channel



      <?php

      /*
      |--------------------------------------------------------------------------
      | Broadcast Channels
      |--------------------------------------------------------------------------
      |
      | Here you may register all of the event broadcasting channels that your
      | application supports. The given channel authorization callbacks are
      | used to check if an authenticated user can listen to the channel.
      |
      */

      Broadcast::channel('App.User.{id}', function ($user, $id) {
      return true;//(int) $user->id === (int) $id;
      });


      Route web



      <?php

      /*
      |--------------------------------------------------------------------------
      | Web Routes
      |--------------------------------------------------------------------------
      |
      | Here is where you can register web routes for your application. These
      | routes are loaded by the RouteServiceProvider within a group which
      | contains the "web" middleware group. Now create something great!
      |
      */


      Auth::routes();

      Route::get('/send/{user}', function(AppUser $user){

      event(new AppEventsSendMessageEvent($user));

      });

      Route::get('/home', 'HomeController@index')->name('home');


      Laravel.log showing my broascast



          [2018-11-04 09:39:42] local.INFO: Broadcasting [AppEventsSendMessageEvent] on channels [private-App.User.1] with payload:
      {
      "message": "Salut nathalie",
      "socket": null
      }


      redis-cli monitor showing my homecontroller test



      1541324518.159040 [0 127.0.0.1:59334] "SELECT" "0"
      1541324518.159776 [0 127.0.0.1:59334] "SET" "foo" "bar"
      1541324518.160360 [0 127.0.0.1:59334] "GET" "foo"









      share|improve this question













      I have tried sereval tuto to try to setup Laravel Redis NodeJs Socket.



      And it'is not working.



      So far :
      - my broadcast fires as I can see it in Laravel log
      - my redis server works (I have added a call to Redis in my homecontroller and I can see the value in the log and in redis-cli monitor - I have also installed Horizon and I can see its call in Redis-cli monitor)



      But when my broadcast fires I don't see anything in redis-cli monitor



      I have already tried the obvious things (cache/ config clear / reboot / ...)



      Help will be very apreciated !



      Redis call in my homecontroller : working



      Redis::set("foo","bar");
      $value = Redis::get("foo");
      Log::debug('Redis value :'.$value);


      .Env



      LOG_CHANNEL=stack

      DB_CONNECTION=mysql
      DB_HOST=127.0.0.1
      DB_PORT=3306
      DB_DATABASE=siview
      DB_USERNAME=root
      DB_PASSWORD=


      QUEUE_DRIVER=sync
      QUEUE_CONNECTION=sync

      CACHE_DRIVER=file

      SESSION_DRIVER=file
      SESSION_LIFETIME=120


      BROADCAST_DRIVER=redis
      REDIS_HOST=127.0.0.1
      REDIS_PASSWORD=null
      REDIS_PORT=6379

      MAIL_DRIVER=smtp
      MAIL_HOST=smtp.mailtrap.io
      MAIL_PORT=2525
      MAIL_USERNAME=null
      MAIL_PASSWORD=null
      MAIL_ENCRYPTION=null

      PUSHER_APP_ID=
      PUSHER_APP_KEY=
      PUSHER_APP_SECRET=
      PUSHER_APP_CLUSTER=mt1

      MIX_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
      MIX_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"


      Database.php



       'redis' => [
      'client' => 'predis',

      'default' => [
      'host' => env('REDIS_HOST', 'localhost'),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => 0,
      'read_write_timeout' => 60,
      ],

      'cache' => [
      'host' => env('REDIS_HOST', '127.0.0.1'),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => env('REDIS_CACHE_DB', 1),
      ],

      'pubsub' => [
      'host' => env('REDIS_HOST', 'localhost'),
      'password' => env('REDIS_PASSWORD', null),
      'port' => env('REDIS_PORT', 6379),
      'database' => 2,
      ],




      ],


      Boadcasting.php



      <?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', 'redis'),

      /*
      |--------------------------------------------------------------------------
      | 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'),
      'secret' => env('PUSHER_APP_SECRET'),
      'app_id' => env('PUSHER_APP_ID'),
      'options' => [
      'cluster' => env('PUSHER_APP_CLUSTER'),
      'encrypted' => true,
      ],
      ],

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

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

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

      ],

      ];


      Event



      <?php

      namespace AppEvents;

      use IlluminateBroadcastingChannel;
      use IlluminateQueueSerializesModels;
      use IlluminateBroadcastingPrivateChannel;
      use IlluminateBroadcastingPresenceChannel;
      use IlluminateFoundationEventsDispatchable;
      use IlluminateBroadcastingInteractsWithSockets;
      use IlluminateContractsBroadcastingShouldBroadcast;
      use AppUser;


      class SendMessageEvent implements ShouldBroadcast
      {
      use Dispatchable, InteractsWithSockets, SerializesModels;

      private $user;

      /**
      * Create a new event instance.
      *
      * @return void
      */
      public function __construct(User $user)
      {
      $this->user = $user;
      }

      /**
      * Get the channels the event should broadcast on.
      *
      * @return IlluminateBroadcastingChannel|array
      */
      public function broadcastOn()
      {
      return new PrivateChannel('App.User.' . $this->user->id);
      }

      public function broadcastWith()
      {
      return ['message' => 'Salut ' . $this->user->name];
      }
      }


      Route Channel



      <?php

      /*
      |--------------------------------------------------------------------------
      | Broadcast Channels
      |--------------------------------------------------------------------------
      |
      | Here you may register all of the event broadcasting channels that your
      | application supports. The given channel authorization callbacks are
      | used to check if an authenticated user can listen to the channel.
      |
      */

      Broadcast::channel('App.User.{id}', function ($user, $id) {
      return true;//(int) $user->id === (int) $id;
      });


      Route web



      <?php

      /*
      |--------------------------------------------------------------------------
      | Web Routes
      |--------------------------------------------------------------------------
      |
      | Here is where you can register web routes for your application. These
      | routes are loaded by the RouteServiceProvider within a group which
      | contains the "web" middleware group. Now create something great!
      |
      */


      Auth::routes();

      Route::get('/send/{user}', function(AppUser $user){

      event(new AppEventsSendMessageEvent($user));

      });

      Route::get('/home', 'HomeController@index')->name('home');


      Laravel.log showing my broascast



          [2018-11-04 09:39:42] local.INFO: Broadcasting [AppEventsSendMessageEvent] on channels [private-App.User.1] with payload:
      {
      "message": "Salut nathalie",
      "socket": null
      }


      redis-cli monitor showing my homecontroller test



      1541324518.159040 [0 127.0.0.1:59334] "SELECT" "0"
      1541324518.159776 [0 127.0.0.1:59334] "SET" "foo" "bar"
      1541324518.160360 [0 127.0.0.1:59334] "GET" "foo"






      laravel redis broadcast






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 4 at 10:03









      Nathalie

      1108




      1108
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          I have found and it's a bit strange :



          I am working on windows with wamp.



          The wamp server was started by not the Laravel server.



          Strangly everything seemed to work well (no errors, pages rendered, auth was working...)



          I just started laravel with : php artisan serve
          and now I can see in Redis-cli monitor :



          1541328214.873429 [0 127.0.0.1:52962] "SELECT" "2"
          1541328214.874260 [2 127.0.0.1:52962] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
          1541328661.366923 [0 127.0.0.1:53078] "SELECT" "2"
          1541328661.367643 [2 127.0.0.1:53078] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
          1541328679.554077 [0 127.0.0.1:53083] "SELECT" "2"
          1541328679.555197 [2 127.0.0.1:53083] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"





          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139618%2flaravel-broadcasting-doest-write-to-redis-but-direct-call-to-redis-works%23new-answer', 'question_page');
            }
            );

            Post as a guest
































            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote



            accepted










            I have found and it's a bit strange :



            I am working on windows with wamp.



            The wamp server was started by not the Laravel server.



            Strangly everything seemed to work well (no errors, pages rendered, auth was working...)



            I just started laravel with : php artisan serve
            and now I can see in Redis-cli monitor :



            1541328214.873429 [0 127.0.0.1:52962] "SELECT" "2"
            1541328214.874260 [2 127.0.0.1:52962] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
            1541328661.366923 [0 127.0.0.1:53078] "SELECT" "2"
            1541328661.367643 [2 127.0.0.1:53078] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
            1541328679.554077 [0 127.0.0.1:53083] "SELECT" "2"
            1541328679.555197 [2 127.0.0.1:53083] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"





            share|improve this answer

























              up vote
              0
              down vote



              accepted










              I have found and it's a bit strange :



              I am working on windows with wamp.



              The wamp server was started by not the Laravel server.



              Strangly everything seemed to work well (no errors, pages rendered, auth was working...)



              I just started laravel with : php artisan serve
              and now I can see in Redis-cli monitor :



              1541328214.873429 [0 127.0.0.1:52962] "SELECT" "2"
              1541328214.874260 [2 127.0.0.1:52962] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
              1541328661.366923 [0 127.0.0.1:53078] "SELECT" "2"
              1541328661.367643 [2 127.0.0.1:53078] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
              1541328679.554077 [0 127.0.0.1:53083] "SELECT" "2"
              1541328679.555197 [2 127.0.0.1:53083] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"





              share|improve this answer























                up vote
                0
                down vote



                accepted







                up vote
                0
                down vote



                accepted






                I have found and it's a bit strange :



                I am working on windows with wamp.



                The wamp server was started by not the Laravel server.



                Strangly everything seemed to work well (no errors, pages rendered, auth was working...)



                I just started laravel with : php artisan serve
                and now I can see in Redis-cli monitor :



                1541328214.873429 [0 127.0.0.1:52962] "SELECT" "2"
                1541328214.874260 [2 127.0.0.1:52962] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
                1541328661.366923 [0 127.0.0.1:53078] "SELECT" "2"
                1541328661.367643 [2 127.0.0.1:53078] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
                1541328679.554077 [0 127.0.0.1:53083] "SELECT" "2"
                1541328679.555197 [2 127.0.0.1:53083] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"





                share|improve this answer












                I have found and it's a bit strange :



                I am working on windows with wamp.



                The wamp server was started by not the Laravel server.



                Strangly everything seemed to work well (no errors, pages rendered, auth was working...)



                I just started laravel with : php artisan serve
                and now I can see in Redis-cli monitor :



                1541328214.873429 [0 127.0.0.1:52962] "SELECT" "2"
                1541328214.874260 [2 127.0.0.1:52962] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
                1541328661.366923 [0 127.0.0.1:53078] "SELECT" "2"
                1541328661.367643 [2 127.0.0.1:53078] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"
                1541328679.554077 [0 127.0.0.1:53083] "SELECT" "2"
                1541328679.555197 [2 127.0.0.1:53083] "PUBLISH" "private-App.User.1" "{"event":"App\\Events\\SendMessageEvent","data":{"message":"Salut nathalie","socket":null},"socket":null}"






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 4 at 10:56









                Nathalie

                1108




                1108






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53139618%2flaravel-broadcasting-doest-write-to-redis-but-direct-call-to-redis-works%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest




















































































                    這個網誌中的熱門文章

                    Tangent Lines Diagram Along Smooth Curve

                    Yusuf al-Mu'taman ibn Hud

                    Zucchini