Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Laravel websocket and react native - ExceptionsManager.js:180 TypeError: Cannot read property 'presenceChannel' of undefined #789

@aliyari1990

Description

@aliyari1990

Hi guys,
I have developed a react app using laravel and react-js by laravel-websockets and it works well !
However, when I want to use it in a react native application, It throws an exception:
ExceptionsManager.js:180 TypeError: Cannot read property 'presenceChannel' of undefined


import Pusher from 'pusher-js/react-native'
import Echo from 'laravel-echo'
newEcho() {
        Pusher.logToConsole = true;
        let push = new Pusher('******',{
            wsHost: 'push.******.com',
            wssPort: 6001,
            wsPort:  6001,
        })
        return new Echo({
            broadcaster: push,
            key: '********'
            disableStats: true,
            forceTLS: true,
            authEndpoint: 'https://*******/broadcasting/auth',
            auth: {
                headers: {
                    Authorization: `Bearer ${API_TOKEN}`,
                    Accept: 'application/json',
                },
            },
        });
    }

    componentDidMount() {
        let EchoChannel = this.newEcho().join(`chat.${this.state.drtoken}`);
        console.log(EchoChannel);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions