Category : socket.io

I have created an event: <?php namespace AppEvents; use IlluminateBroadcastingChannel; use IlluminateBroadcastingInteractsWithSockets; use IlluminateBroadcastingPresenceChannel; use IlluminateBroadcastingPrivateChannel; use IlluminateContractsBroadcastingShouldBroadcast; use IlluminateFoundationEventsDispatchable; use IlluminateQueueSerializesModels; class QueueStatus implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; public $queue; public function __construct() { $queue = ‘test2’; } public function broadcastOn() { return new Channel(‘thechannel’); } public function broadcastWith() { return [‘test1’]; ..

Read more

Here is the event: class AssetsInfo implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; public $actionId; public $actionData; public function __construct($actionId, $actionData) { $this->actionId = $actionId; $this->actionData = $actionData; } public function broadcastOn() { return new Channel(‘sahmshenas-channel’); } public function broadcastWith() { return [ ‘actionId’ => $this->actionId, ‘actionData’ => $this->actionData, ]; } public function broadcastAs(){ return ..

Read more

I have created a laravel event: <?php namespace AppEvents; use IlluminateBroadcastingChannel; use IlluminateBroadcastingInteractsWithSockets; use IlluminateBroadcastingPresenceChannel; use IlluminateBroadcastingPrivateChannel; use IlluminateContractsBroadcastingShouldBroadcastNow; use IlluminateFoundationEventsDispatchable; use IlluminateQueueSerializesModels; class AssetsInfo implements ShouldBroadcastNow { use Dispatchable, InteractsWithSockets, SerializesModels; public $actionId; public $actionData; public function __construct($actionId, $actionData) { $this->actionId = $actionId; $this->actionData = $actionData; } public function broadcastOn() { return new Channel(‘sahmshenas-channel’); ..

Read more

i am using laravel 8.12 with laravel echo and redis problem : when i add chat_id to private channel name from event, socket request return 403 error however Presence channel work correctly and there is my code: controller: public function store(Request $request) { $message = Message::create([‘sender_id’ => $request->sender_id,’content’ => $request->message ,’message_type’ => ‘message’,’chat_id’ => $request->chat_id ..

Read more

I’m using Laragon. First time working with sockets in laravel. I am trying to get the current online, but when I start the server in the console I see errors: Access to XMLHttpRequest at ‘http://zernovka.test:7777/socket.io/?EIO=3&transport=polling&t=NNdd1z3’ from origin ‘http://zernovka.test’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. GET http://localhost:7777/socket.io/?EIO=3&transport=polling&t=NNdd1tW ..

Read more

I am using redis and laravel-echo-server for broadcasting. When i init Echo in my bootstrap.js like: import Echo from ‘laravel-echo’; window.io = require(‘socket.io-client’); if (typeof io !== ‘undefined’) { window.Echo = new Echo({ broadcaster: ‘socket.io’, host: window.location.hostname + ‘:6001’, }) } I get error in console: app.js:12063 POST http://app.blog:6001/socket.io/?EIO=4&transport=polling&t=NMmu7VC 400 (Bad Request) When i click ..

Read more

I am trying to broadcast a channel for my client application from the lumen app using the laravel echo server. here I can successfully broadcast a public channel but when I try to broadcast a private channel my laravel echo server throw en error Error authenticating qEWAcyHQxWrbCvFmAAAA for private-example-channel Error: Invalid URI "http:localhost:85/broadcasting/auth" I have ..

Read more

I’m a newbie in Laravel. I have a problem when I tried to built a realtime message with Laravel & ReactJS, Socket.io , Redis Errors when I start laravel-echo server file laravel-echo-server.json { "authHost": "http://localhost:8000", "authEndpoint": "/broadcasting/auth", "clients": [ { "appId": "XXXXXXXXXX", "key": "XXXXXXXXXXXXXXXXXXXXX" } ], "database": "redis", "databaseConfig": { "redis": {}, "sqlite": { "databasePath": ..

Read more

I am using laravel 5.8 on my nginx server with laravel echo server, socket.io and redis. My site was working till yesterday with no error but today it has been giving me socket errors such as: GET https://example.com:6001/socket.io/?EIO=3&transport=polling&t=NHtNFvZ net::ERR_SSL_PROTOCOL_ERROR This my laravel-echo-server.json file: { "authHost": "http://localhost:8000", "authEndpoint": "/broadcasting/auth", "clients": [ { "appId": "123", "key": "123" ..

Read more

I have created a Laravel application and used node js with socket.io for the chat and I want both the application to run on the same domain and my website is hosted on the AWS server. I had installed an SSL certificate using ACM When I open my Laravel website (https//:example.com) on a browser it ..

Read more

im trying to connect my backend laravel to my frontend nuxt, what im trying to do here is, i want to send response to client when server execute/process some url/api. i want my client get response after server execute this url /api/test-broadcast-notification. here’s the route. Route::get(‘test-broadcast-notification’, function() { $user = AppUser::find(1); event(new AppEventsPrivateMessage($user)); }); my ..

Read more

I want to whisper my dynamic data from saved item by socket-io but it only accepts strings (static data) Sample code .whisper(‘userInAddProduct’, { name: ‘david’, id: 5 }) my data .whisper(‘userInAddProduct’, { name: res.data.name, id: res.data.id }) With my code on listenForWhisper I will get undefined but with static data (sample #1) I get the ..

Read more

I am using Laravel 5.5 and I have implemented some datatable with DataTables.net for the view of alarms coming from the corporate network. These alarms are stored in a MySql database. I would like my tables in the blade to update automatically when a new record is stored in the table or when an update ..

Read more