laravel-echo

WebSocket connection to <URL> failed: Error during WebSocket handshake: Unexpected response code: 521

こ雲淡風輕ζ 提交于 2020-05-24 04:53:08
问题 I have a problem with connecting to the socket server. WebSocket connection to <URL> failed: Error during WebSocket handshake: Unexpected response code: 521 I have two different cloud server (1) for a client project and (2) for a socket server. (1) Client Project: var token = "{{ csrf_token() }}"; window.Echo = new Echo({ broadcaster: 'socket.io', host: "{{env('SOCKET_SERVER_HOST')}}", origin: '*', transports: ['websocket', 'polling', 'flashsocket', 'ws', 'wss'], auth: { headers: { 'X-CSRF

Laravel Broadcasting, how to auth to a presence channel?

寵の児 提交于 2020-04-18 05:47:31
问题 I'm trying to join a presence channel (Public channels work well), but I can't get this to work: Vue code: mounted(){ Echo.join('game.' + "0").here((users) => { alert("In the channel!"); }) .joining((user) => { console.log("Someone entered"); }) .leaving((user) => { console.log(user.name); }) .listen('GameEvent', (e) => { console.log("Hey") }); Echo.channel('NewSentence') .listen('NewSentence',(sentence)=>{ alert("HOLA"); }); } I'm trying to join the channel "game.0". As I'm using Laravel

Private channel not working with Laravel echo server

拜拜、爱过 提交于 2020-04-06 04:11:04
问题 I'm getting this JS error on the console: app.js:167 Uncaught ReferenceError: receiverId is not defined Here is my complete code: PrivateChatController: event(new PrivateMessageEvent($chat, $receiverId)); PrivateMessageEvent: namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Queue\SerializesModels; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting

Private channel not working with Laravel echo server

旧街凉风 提交于 2020-04-06 04:07:49
问题 I'm getting this JS error on the console: app.js:167 Uncaught ReferenceError: receiverId is not defined Here is my complete code: PrivateChatController: event(new PrivateMessageEvent($chat, $receiverId)); PrivateMessageEvent: namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Queue\SerializesModels; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting

Private channel not working with Laravel echo server

笑着哭i 提交于 2020-04-06 04:07:09
问题 I'm getting this JS error on the console: app.js:167 Uncaught ReferenceError: receiverId is not defined Here is my complete code: PrivateChatController: event(new PrivateMessageEvent($chat, $receiverId)); PrivateMessageEvent: namespace App\Events; use Illuminate\Broadcasting\Channel; use Illuminate\Queue\SerializesModels; use Illuminate\Broadcasting\PrivateChannel; use Illuminate\Broadcasting\PresenceChannel; use Illuminate\Foundation\Events\Dispatchable; use Illuminate\Broadcasting

Broadcast::channel callback function is not called

亡梦爱人 提交于 2020-01-25 10:21:07
问题 I have a problem where event is properly fired, but the data is not returned from authorization callback function inside Broadcast::channel method. The event looks like this: public function __construct($userId, $message, $username, $profileImg, $fixtureId) { $this->message = $message; $this->username = $username; $this->profileImg = $profileImg; $this->userId = $userId; $this->fixtureId = $fixtureId; } The channel (presence) is created and broadcasted like this: public function broadcastOn()

authentication issue with laravel private channel and laravel-echo-server

随声附和 提交于 2020-01-03 04:19:04
问题 I'm using laravel-echo-server along with Redis and vuejs to broadcast events through websockets in Laravel 5.5. with public channels it is working fine and events get broadcasted to client-side correctly. But when I change it to private channel I face problem of authentication even if the callback function inside channel.php file just return true and does not contain any logic for authentication. I'm using Sentinel authentication package and I don't know if this is the problem. But as I said,

Why broadcasting channel public not working? Laravel

余生长醉 提交于 2019-12-25 01:03:10
问题 I use laravel 5.3 I make routes/channels.php like this : <?php Broadcast::channel('messages', function() { return true; }); If I input the data cart and click submit, it will run this : this.$http.post(window.BaseUrl + '/guest/add-notification', {cart_data: JSON.stringify(data)}); It will call function on the controller The function like this : public function addNotification(Request $request){ $input = $request->only('cart_data'); $data = json_decode($input['cart_data'], true); event(new

Laravel - Pusher - Detect when a user is no longer in the website or leaves the page

安稳与你 提交于 2019-12-24 00:07:21
问题 I'm facing a problem with a real time app that i'm developing. My problem is about user's status using Pusher. I would like to get the correct way to detect when a user leaves the page or keep unactive for a while to set it's status to 'offline', for example. How could I achieve that? I'm almost sure that is not recommended develop this feature at client-side, it should be at server-side, but how? How can I ask to clients if they are still there? Should I create a command and run it wit cron?

Laravel /broadcasting/auth Always Fails With 403 Error

萝らか妹 提交于 2019-12-18 21:50:19
问题 I have recently delved into Laravel 5.3's Laravel-Echo and Pusher combination. I have successfully set up public channels and moved on to private ones. I am having trouble with Laravel returning a 403 from the /broadcasting/auth route, no matter what I do to try to authorize the action (up to and including using a simple return true statement). Can anyone tell me what I am doing wrong? App/Providers/BroadcastServiceProvider.php: namespace App\Providers; use Illuminate\Support\ServiceProvider;