laravel-echo

How to use socket.io-client in angular 4

岁酱吖の 提交于 2019-12-18 10:29:33
问题 Server side is php laravel echo websocket and I am trying to connect by Angular 4. I tried using ng2-socket-io - npm and also laravel-echo - npm but none of them were successfully. If anyone know any documentation or tutorial how I can use it, please help 回答1: Hi @giga Working example is given below. SETUP npm i socket.io-client --save npm i @types/socket.io-client --save Server-side (nodejs) var express = require('express'); var path = require('path'); var app = express(); var server =

Configuring Apache Reverse Proxy For Hosting Laravel Echo Server On Production

空扰寡人 提交于 2019-12-14 00:34:00
问题 I need to host a laravel application that utilizes laravel-echo-server over a HTTPS server. I want to use Apache's reverse proxy to redirect my /socket.io url polls to 127.0.0.1 on port 6001 which is where laravel-echo-server is running on within the same domain url. For example over https://example.com when my laravel-echo-server sends url polls to https://example.com/socket.io apache should redirect it to http://127.0.0.1:6001 within that same domain. NOTICE I'm not hosting my laravel app

laravel 5.7 + vue.js 2 + laravel echo + pusher, how to make them work together?

故事扮演 提交于 2019-12-11 15:19:44
问题 I am able to configure Laravel Echo with Pusher and install all the necessary dependencies. I have watch tutorials on lynda and laracast how to do this, but they are old and not for these versions in the title of this question. So, from what i have learned so far from lynda and laracast i have to run Vue from the blade template, but i cant make this work unless i add manual this line of code <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script> inside my blade engine. i

Error Echo is not Defined

。_饼干妹妹 提交于 2019-12-11 15:13:06
问题 I'm using pusher and have been trying to configure Laravel Echo as guided in the docs. I have added the following code to bootstrap.js import Echo from 'laravel-echo' window.Pusher = require('pusher-js'); window.Echo = new Echo({ broadcaster: 'pusher', key: '###key###', cluster: 'ap2', encrypted: true }); After compiling and running the code and I try to use Echo to subscribe to a channel, I get the console error that Echo is not defined . I suspect that when Laravel Mix (5.4) is compiling

Laravel Echo presence channel not working well with vue router

回眸只為那壹抹淺笑 提交于 2019-12-11 09:55:24
问题 The app is a chat app, using laravel and Vue, once a user logs in he sees the list of all online users, I called the Echo wrapper in the mounted component of the home page to show all online users, it works and shows them, the issue now is if I go to another page (via Vue Router) and then comeback to the home page it doesn't show the list of online users... Except manually i refresh the page again. Below is a snippet of my code: mounted () { // alert('Shoud work') // console.log(Echo) Echo

How to define or pass auth guard for broadcast authentication routes instead of default auth guard?

北战南征 提交于 2019-12-10 19:26:15
问题 I am very new to realtime event broadcasting, I have simple laravel-echo-server setup and working with everything. I am unable to set/define authentication against other auth guard it is always checking with user/default guard defined in auth.php I have setup the authentication routes for each guards private channels in routes/channel.php as below per documentation. For auth guard user private channels Broadcast::channel('users.{id}', function ($user, $id) { Log::info(class_basename($user));

Laravel queue event not serializing models

↘锁芯ラ 提交于 2019-12-08 08:43:32
问题 Not sure if i did something wrong, but when attempting do broadcast an event, the SerializesModels only serializes the first model I throw at it. class WorkerQueueEvent implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; protected $user; public $queue; public function __construct(User $user,QueueJob $queue) { $this->user = $user; $this->queue = $queue; } public function broadcastOn() { return new PrivateChannel('Queues/' . $this->user->id); } } This results

Laravel Echo cannot subscribe to Pusher private channel

霸气de小男生 提交于 2019-12-07 17:09:14
问题 I am not able to listen to an event in a private channel. However, I can listen to public channel. The problem This works: Echo.channel('Foo.Bar') .listen('MyEvent', (e) => { console.log('It worked!'); }); I can see in Pusher Debug Console that there are three consecutive events: CONNECTION SUBSCRIBED OCCUPIED Plus, if I send Channel: Foo.Bar; Event: App\Events\MyEvent , I can see the output in my browser console. However, this doesn't work: Echo.private('Foo.Bar') .listen('MyEvent', (e) => {

Laravel queue event not serializing models

天大地大妈咪最大 提交于 2019-12-06 15:49:01
Not sure if i did something wrong, but when attempting do broadcast an event, the SerializesModels only serializes the first model I throw at it. class WorkerQueueEvent implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; protected $user; public $queue; public function __construct(User $user,QueueJob $queue) { $this->user = $user; $this->queue = $queue; } public function broadcastOn() { return new PrivateChannel('Queues/' . $this->user->id); } } This results in the queue never being processed. If i do an dd($queue); or dd($user); in the constructer, it does

How to use socket.io-client in angular 4

China☆狼群 提交于 2019-11-29 23:15:32
Server side is php laravel echo websocket and I am trying to connect by Angular 4. I tried using ng2-socket-io - npm and also laravel-echo - npm but none of them were successfully. If anyone know any documentation or tutorial how I can use it, please help Hi @giga Working example is given below. SETUP npm i socket.io-client --save npm i @types/socket.io-client --save Server-side (nodejs) var express = require('express'); var path = require('path'); var app = express(); var server = require('http').Server(app); var io = require('socket.io')(server); var port = 8000; app.use(express.static(path