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 I really appreciate your time and I hope for a solution.
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);
}