Category : socket.io

I am using vue.js(Laravel) to connect with my chat node server, its connect socket but emit not work with function. var socket = io.connect(‘http://localhost:3000/api/message’); socket.on(‘connect’, function () { var mapdata = {chatId: this.chatIdd, userId: this.userIdd} socket.emit("joinChat", JSON.stringify(mapdata) ,function(confirmation){ alert(‘Work’); console.log(confirmation); }); }.bind(this)); socket.on(‘msgReceive’, function () { }.bind(this)); alert(‘Work’) Not showing. How can i resolve this? ..

Read more

I’m trying to broadcasting to presence channel. But auth seems to not send a member data. Versions composer.json "laravel/framework": "6.20.22", "laravel/passport": "9.0", "predis/predis": "1.1.7", package.json laravel-echo-server: 1.6.2 "socket.io-client": "2.4.0", "laravel-echo": "1.10.0", Server side .env BROADCAST_DRIVER=redis QUEUE_CONNECTION=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 REDIS_PREFIX= laravel-echo-server.json { "authHost": "http://localhost:8080", "authEndpoint": "/custom/broadcasting/auth", "clients": [], "database": "redis", "databaseConfig": { "redis": {}, "sqlite": ..

Read more

I have an issue with mixed content. When I’m trying to use socket.io with laravel on AWS Elastic Beanstalk the following error occurs every 5 seconds or so (in the console): polling-xhr.js:272 Mixed Content: The page at ‘https://mypage.com/’ was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint ‘http://mypage.com:7000/socket.io/?EIO=3&transport=polling&t=NdlasTp’. This request has been blocked; the ..

Read more

I have this weird issue I can’t fix with authenticating private channels. I am using Laravel 8, NuxtJS (SPA app), Redis, and separate Docker containers for everything. When I am trying to listen in my SPA NuxtJs app for private channel I get following error: 42["subscription_error","private-robert-test-1",0] I assume this is because of my echo confing ..

Read more

I’m creating a chat on Laravel using socket.io. It works fine on localhost but when I deploy it on the server it gives the error "GET https://octadesigns.com:7000/socket.io/?EIO=3&transport=polling&t=NdDh-pF net::ERR_CONNECTION_TIMED_OUT". It’s a shared Namecheap hosting I have a port open 7000 on the server, I have chat with the server support team they are asking to run ..

Read more

I’m using this tutorial for laravel broadcast with redis and socket-io, https://www.itsolutionstuff.com/post/laravel-broadcast-redis-socket-io-tutorial-example.html. But in the final result, I don’t get any message on page, actually it doesn’t listen to the event when it fires. Redis out put 1622090795.392138 [0 127.0.0.1:40302] "SELECT" "0" 1622090795.392327 [0 127.0.0.1:40302] "EVAL" "for i = 2, #ARGV don redis.call(‘publish’, ARGV[i], ARGV[1])nend" ..

Read more

I want to use laravel-echo to send notifications to users. I wrote a simple event to test the broadcast. I did everything base on tutorials, but I seems that the client is not listening on right channel. here is my laravel-echo-server config: { "authHost": "http://demo.xxx.io", "authEndpoint": "/broadcasting/auth", "clients": [], "database": "redis", "databaseConfig": { "redis": {}, ..

Read more

I have tried to change the port 6001 to other ports but always comes the same error chrome/firefox Firefox can’t establish a connection to the server at wss://vois.chat:6001/app/be217bd4eb3a33bd3ff1?protocol=7&client=js&version=4.3.1&flash=false. bootstrap.js import Echo from "laravel-echo" window.Pusher = require(‘pusher-js’); window.Echo = new Echo({ broadcaster: ‘pusher’, key: process.env.MIX_PUSHER_APP_KEY, cluster: process.env.MIX_PUSHER_APP_CLUSTER, wsHost: window.location.hostname, wsPort: 6001, wssPort: 6001, disableStats: true, encrypted: ..

Read more

I’m trying to implement chat functionality with laravel echo server using socket.io but unable to listen to the event Here is my below code bootstrap.js import Echo from ‘laravel-echo’ window.Echo = new Echo({ broadcaster: ‘socket.io’, host: ‘http://127.0.0.1:6001’, auth: { headers: { Authorization : ‘my_bearer token’ } } }); app.js require(‘./bootstrap’); import Vue from ‘vue’; const ..

Read more

I need to send the response from a channel to the sender socket when an event from backend is invoked. Right it successfully broadcasts to all other sockets but not the sender. How can I achieve this? socket.js ‘use strict’; var cors = require(‘cors’); var app = require(‘express’)(); app.use(cors({origin: ‘*’})); var server = require(‘http’).Server(app); var ..

Read more

For some reason, only sender should receive the broadcast message invoked by an event. But all other connected clients get it except for the sender. Is there any configuration on socket.io that needed to be changed? socket.js file ‘use strict’; var cors = require(‘cors’); var app = require(‘express’)(); app.use(cors({origin: ‘*’})); var server = require(‘http’).Server(app); var ..

Read more

So I’m trying to make backend laravel and frontend Angular to work. Laravel version 5.8 and Angular 7.2 I have my event public function broadcastOn() { return new Channel(‘test’); } public function broadcastAs() { return ‘message.sent’; } I made a route to call it Route::get(‘/fire’, function () { event(new AppEventsMessagesMessageEvent()); return ‘ok’; }); And in ..

Read more