Laravel echo is no listening

laravel echo pusher not working
laravel echo tutorial
angular-laravel-echo example
laravel-echo stop listening
laravel websocket
laravel echo service worker
laravel echo heartbeat
laravel echo leave channel

i'm from venezuela, i've a problem tryging to integrate laravel echo with a project, i try everything and i wanna receive your help.

maybe i'm not working with the right way.

i'm trying to use broadcasting events with socket io because i'm working in a startup and is very difficult pay a services like pusher.

i'm trying to do a simple real time chat..

That is my chatController..

public function index(Request $request){

  $sender=Auth::user()->id;
  $receiver=\App\User::find(2);
  $message=new Message;
  $message->message="Hola, esto es una prueba de eventos";
  $message->user_receiver_id=$receiver->id;
  $message->user_sender_id=Auth::user()->id;
  $message->id_chat=1;
  $message->save();

  event(new \App\Events\sendMessage($message,$receiver));

  return response()->json(["status"=>"ok"]);
}

This chat store in a database the messages according to determinate group (chat).

The event that will be fired is:

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

/**
 * Create a new event instance.
 *
 * @return void
 */

public $message;
public $user_receiver;

public function __construct(Message $message,User $user_receiver)
{
    $this->message=$message;
    $this->user_receiver=$user_receiver;

}

public function broadcastOn()
{
    \Log::info($this->message->id_chat);

    return new PrivateChannel('chat.1');


}}

My app.js is:

require('./bootstrap');
import Echo from "laravel-echo";

window.Echo = new Echo({
broadcaster: 'socket.io',
host: window.location.hostname + ':6001'
});


window.Echo.channel('chat.1')
.listen('sendMessage', e => {
    console.log(e);
});

at the first instance i just wanna get the public variables from my sendMessages event, after this i will to build the view.

I run the php artisan listener and i run de laravel echo server.

when i send a message this happen with the laravel echo server and the listener:

Laravel echo server output

enter image description here

I think that the process work fine but i think that i only have a problem with the client..

because nothing happen in the client when i send the message.

Sorry for my english, i hope that you can help me.


This problem is very hard to troubleshoot without complete source code and running app.

I have implemented all 3 types of channels(private, public & presence) in this chat app, maybe you can get some ideas from it:

https://github.com/xparthx/laravel-realtime-chat

Thanks

Laravel Echo Not Listening, Laravel Echo Not Listening. Posted 2 years ago by LorienDarenya. At least, that's what I assume is happening. I have been following this  I run the php artisan listener and i run de laravel echo server. when i send a message this happen with the laravel echo server and the listener: Laravel echo server output. enter image description here. I think that the process work fine but i think that i only have a problem with the client.. because nothing happen in the client when i send


You should only use use SerializesModels;

Also, broadcast(new \App\Events\sendMessage($message,$receiver));

You can find Laravel 5 Broadcasting example here,

https://github.com/durmus-aydogdu/real-time-application

Laravel Echo not listening/working on pusher channel event, Hi I have been trying to use Laravel Echo with pusher after going through the tutorial on Laracasts. I am trying to listen on a public channel just as I' using Laravel 5.3, Node, Laravel Echo, Redis, and socket.io. I have my events setup, node server listening on port 8888, redis pubsub is connection with node working. Everything on the backend is working.


You are broadcasting in Laravel on a PrivateChannel so you need to use the following when connecting with Echo:

window.Echo.private('chat.1').listen('sendMessage', e => {console.log(e);});

If you're still having problems then have a look at this reply

Not receiving event in Laravel Echo channel listener · Issue #116 , But the last step, logging the event in my browser console is not working. Laravel Echo Server config: { "appKey": "base64:somethingsecret123", "  Laravel Echo Not Listening /** * Echo exposes an expressive API for subscribing to channels and listening * for events that are broadcast by Laravel. Echo and


listen does no working · Issue #237 · laravel/echo · GitHub, Echo Version: 1.5.4 Laravel Version: 5.8.26 PHP Version: 7.2.18 NPM Version: 6.10.0 Node Version:10.15.3 Description: The client cannot  import Echo from "laravel-echo" window.Echo = new Echo({ broadcaster: 'pusher', key: 'your-pusher-channels-key' }); When creating an Echo instance that uses the pusher connector, you may also specify a cluster as well as whether the connection must be made over TLS (by default, when forceTLS is false , a non-TLS connection will be made if the page was loaded over HTTP, or as a fallback if a TLS connection fails):


Broadcasting - Laravel, Laravel Echo is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by Laravel. when forceTLS is false , a non-TLS connection will be made if the page  Broadcasting your Laravel events allows you to share the same event names between your server-side code and your client-side JavaScript application. Laravel Echo is a JavaScript library that makes it painless to subscribe to channels and listen for events broadcast by Laravel.


laravel-echo: Docs, Tutorials, Reviews, laravel-echo documentation, tutorials, reviews, alternatives, versions, Merge branch 'master' of github.com:laravel/echo; Fix dist/echo.js not being transpiled to ES5 A method to stop listening for the notification event. Laravel echo not listening for events Posted 4 weeks ago by hardcode27 Hey guys , I'm trying to build a real-time app using laravel, react, redis and of course laravel-echo , and my problem is that everything works fine but i think that my react front isn't listening for my event , here is the code of my .jsx file (sorry i don't know how use)