Category : sockets

I could connect with the socket with the below code. Laravel version ^7.29 It’s showing connected equal false. socket Socket {connected: false, disconnected: true} NOT WORKING CODE WITH 4.4.0 <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/4.4.0/socket.io.js"></script> <script> const socket_laravel = io(‘http://127.0.0.1:1234’); </script> WORKING CODE WITH 2.1.0 <script src="https://cdnjs.cloudflare.com/ajax/libs/socket.io/2.1.0/socket.io.js"></script> <script> const socket_laravel = io(‘http://127.0.0.1:1234’); </script> Sourc..

Read more

I’ve installed laravel-echo-server with redis. And It looks they work well. But client side, does not listen my socket. I’m sharing my codes and responses; Client side send socket.io request with http://event.test:6001/socket.io/?EIO=4&transport=polling&t=Nd-jQRA address And it returns 96:0{"sid":"wemReBih6HMR8tYUAAHI","upgrades":["websocket"],"pingInterval":25000,"pingTimeout":5000}2:40 My Client side code is like below; <script> Echo.channel(‘refresh’) .listen(‘TriggerRefresh’, e => { console.log(e) }) </script> My bootstrap.js ..

Read more

Access to XMLHttpRequest at ‘http://example.com:7777/socket.io/?EIO=3&transport=polling&t=Ndo7uij’ from origin ‘http://example.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Hello! I’m working with Laravel 7 (Apache) + NodeJS + Redis + Socket. So, when im starting node server i get this error in the site console. Cors.php <?php return [ /* ..

Read more

when I trigger an event, the channel it’s being broadcasted on is getting this format of response: {"channel":"events","event":"AppEventsRealTimeMessage","data":"{"message":"a","channel":"events"}"} I can change the data part from broadcastWith and the previous output will look like this: {"channel":"events","event":"AppEventsRealTimeMessage","data":"{"a"}"} the code is: public function broadcastWith(){ return [$this->message]; } But I want the response to be like this: "a". Source: ..

Read more

Let’s say i’ve created platform named chicken. I have 3 apps (services on local env): frontend app: demo.chicken.test (vue.js) api: demo.api.chicken.test (laravel) socket service: ass.chicken.test (express and socket.io) ‘demo’ is client’s company. So i can have for example platform accesible for another like ‘fast’. So i can have fast.chicken.test, fast.api.chicken.test and ass.chicken.test (ass is shared ..

Read more

I am using Laravel 8.33.1 and mysql Ver 8.0.23-0ubuntu0.20.04.1 for Linux on x86_64 ((Ubuntu)) on my Ubuntu 20.04.1 LTS vps. As during development I also need to access data from my production db. Within my code I do this the following way: $con = "mysql_prod"; // $con = "mysql"; // DB::connection($con)->enableQueryLog(); $data = DB::connection($con)->table(‘test’)->select(‘*’) ->where(‘test.id’, ..

Read more

Using this package https://pub.dev/packages/laravel_echo Current Code import ‘package:example/modal.dart’; import ‘package:flutter/material.dart’; import ‘package:flutter/cupertino.dart’; import ‘package:laravel_echo/laravel_echo.dart’; import ‘package:flutter_pusher_client/flutter_pusher.dart’; class PusherPage extends StatefulWidget { @override State<StatefulWidget> createState() => _PusherPage(); } class _PusherPage extends State<PusherPage> { List<String> _logs = new List(); Echo echo; bool isConnected = false; String channelType = ‘public’; String channelName = ”; String event; FlutterPusher pusherClient; ..

Read more

How ti fix ERR_CONNECTION_REFUSED ? Here are my node.js settings. var app = require(‘express’)(); var http = require(‘http’).Server(app); var io = require(‘socket.io’)(http, { cors: { origin: true, methods: [‘GET’, ‘PATCH’, ‘POST’, ‘PUT’] } }); io.on(‘connection’, function (socket) { socket.on("user_connected", function (user_id) { users[user_id] = socket.id; io.emit(‘updateUserStatus’, users); console.log("user connected "+ user_id); }); }); And my ..

Read more

I am trying to create a live chat. Socket.io and node.js I can’t connect the user to my channel. https://domen.com:8005/socket.io/?EIO=3&transport=polling&t=NYHmcgH :failed Here is my server.js var app = require(‘express’)(); var https = require(‘https’).Server(app); var io = require(‘socket.io’)(https); var Redis = require(‘ioredis’); var redis = new Redis(); var users = []; https.listen(8005, function () { console.log(‘Listening ..

Read more

Does not display messages in real time, only displayed in one window Events class Message implements ShouldBroadcast { use Dispatchable, InteractsWithSockets, SerializesModels; public $message; /** * Create a new event instance. * * @return void */ public function __construct($message) { $this->message = $message; $this->dontBroadcastToCurrentUser(); } /** * Get the channels the event should broadcast on. ..

Read more

I have created a validation system to check if the uploaded files are secured and virus-free, I’m using ClamAV for that purpose. At first I was testing locally on my MACOS using XAMPP but I kept getting the below error Sunspikes ClamavValidator ClamavValidatorException ClamAV scanner client failed with error "Socket operation failed: Connection refused (SOCKET_ECONNREFUSED)" ..

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