Skip to content

TypeError: _this.io.of(...).in(...).clients is not a function #2

@HDVinnie

Description

@HDVinnie

fixed-laravel-echo-server start

  ╔═══╗            ╔╗     ╔╗                        ╔╗      ╔═══╗    ╔╗           ╔═══╗
  ║╔══╝            ║║     ║║                        ║║      ║╔══╝    ║║           ║╔═╗║
  ║╚══╗╔╗╔╗╔╗╔══╗╔═╝║     ║║   ╔══╗ ╔═╗╔══╗ ╔╗╔╗╔══╗║║      ║╚══╗╔══╗║╚═╗╔══╗     ║╚══╗╔══╗╔═╗╔╗╔╗╔══╗╔═╗
  ║╔══╝╠╣╚╬╬╝║╔╗║║╔╗║╔═══╗║║ ╔╗╚ ╗║ ║╔╝╚ ╗║ ║╚╝║║╔╗║║║ ╔═══╗║╔══╝║╔═╝║╔╗║║╔╗║╔═══╗╚══╗║║╔╗║║╔╝║╚╝║║╔╗║║╔╝
 ╔╝╚╗  ║║╔╬╬╗║║═╣║╚╝║╚═══╝║╚═╝║║╚╝╚╗║║ ║╚╝╚╗╚╗╔╝║║═╣║╚╗╚═══╝║╚══╗║╚═╗║║║║║╚╝║╚═══╝║╚═╝║║║═╣║║ ╚╗╔╝║║═╣║║
 ╚══╝  ╚╝╚╝╚╝╚══╝╚══╝     ╚═══╝╚═══╝╚╝ ╚═══╝ ╚╝ ╚══╝╚═╝     ╚═══╝╚══╝╚╝╚╝╚══╝     ╚═══╝╚══╝╚╝  ╚╝ ╚══╝╚╝
----------------------------------------------------------------------------------------------------------
|                                   Powered By AbdoPrDZ "Just Code It";                                  |
----------------------------------------------------------------------------------------------------------

version 0.1.1

Starting server...

✔ Running at localhost on port 8443
✔ Listening for http events...
✔ Listening for redis events...

Server ready!

[2024-04-23T12:33:07.071Z] - ⚠ Client r9bNP2X5DCc1JYYzAAAB connected
/usr/lib/node_modules/@abdopr/fixed-laravel-echo-server/dist/channels/presence-channel.js:35
                .clients(function (error, clients) {
                 ^

TypeError: _this.io.of(...).in(...).clients is not a function
    at /usr/lib/node_modules/@abdopr/fixed-laravel-echo-server/dist/channels/presence-channel.js:35:18
    at new Promise (<anonymous>)
    at PresenceChannel.removeInactive (/usr/lib/node_modules/@abdopr/fixed-laravel-echo-server/dist/channels/presence-channel.js:31:16)
    at /usr/lib/node_modules/@abdopr/fixed-laravel-echo-server/dist/channels/presence-channel.js:20:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v20.12.1

I have been using https://github.com/tlaverdure/laravel-echo-server. Which works ok but two issues.

  1. stuck on old socket.io
    "socket.io": "^2.4.0",
    "socket.io-client": "^2.3.1",

  2. Server crashes from Fixes Cannot read property 'socketId' of undefined tlaverdure/laravel-echo-server#535

Using your package which I really hope I can get, my chatbox does not work. All I see in browser console is

WebSocket connection to 'wss://xxx.dev:8443/socket.io/?EIO=4&transport=websocket' failed: Could not connect to the server.

Then error above popped up in terminal.

My chat.js looks like so:

/**
 * Echo exposes an expressive API for subscribing to channels and listening
 * for events that are broadcast by Laravel. Echo and event broadcasting
 * allows your team to easily build robust real-time web applications.
 */
import Echo from 'laravel-echo';
import Vue from 'vue';
import chatbox from '../components/chat/Chatbox.vue';

import client from 'socket.io-client';

window.io = client;

window.Echo = new Echo({
    broadcaster: 'socket.io',
    host: import.meta.env.VITE_ECHO_ADDRESS,
    forceTLS: true,
    withCredentials: true,
    transports: ['websocket'],
    enabledTransports: ['wss'],
});

new Vue({
    el: '#vue',
    components: { chatbox: chatbox },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions