Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
Unable to receive notifications via Echo using laravel-websockets

When I connect via Channel instead of PrivateChannel, everything works as expected. But when I connect via PrivateChannel, I suddenly stop receiving events inside my javascript My events appear inside the WebSocket dashboard. I dispatch my event like this:

            FullRecipeSaved::dispatch($recipe, $rld);

FullRecipeSaved.php


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

    public $recipe;

    public $recipeLiftingDate;

    public function __construct(Recipe $recipe, RecipeLiftingDate $recipeLiftingDate)
    {
        $this->recipe = $recipe;
        $this->recipe = $recipeLiftingDate;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('recipe');
    }

    /**
     * The event's broadcast name.
     *
     * @return string
     */
    public function broadcastAs()
    {
        return 'recipe.update';
    }
}

channels.php

<?php

Broadcast::channel('recipe', function($recipe, $recipeLiftingDate) {
    return true;
});

bootstrap.js

window.Echo = new Echo({
    broadcaster: "pusher",
    key: process.env.MIX_PUSHER_APP_KEY,
    cluster: process.env.MIX_PUSHER_APP_CLUSTER,
    wsHost: window.location.hostname,
    wsPort: 6001,
    forceTLS: false,
    disableStats: false,
    authEndpoint: GLOBAL.appUrl,
});

The GLOBAL.appUrl is the APP_URL from .env filehttp://localhost/****/public). And this is the code I am using to connect to the channel

window.Echo.private("recipe").listen(
        ".recipe.update",
        (event) => {
            console.log("ok");
        }
    );
over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda