question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Does echo work with React Native?

See original GitHub issue

I’m trying to integrate echo with React Native, i followed the installation guide in the docs and added the following:

import Echo from "laravel-echo"

const EchoNotifications = new Echo({
    broadcaster: 'pusher',
    key: '30c47b6ab35c9be45426'
});

Which gives me the error can't find variable: Pusher and points to this line in echo.js: this.pusher = new Pusher(this.options.key, this.options);

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
danfebraacommented, Aug 21, 2020

@okaufmann using the PR you mentioned. PR #186 Managed to solve mine using with these code block:

/**Note: I am using homestead and on my homestead file I add these lines
This will allow me to let me access my local machine within the network, 
and I can also access this via the emulator (Android)*/

- ssh into your homestead and do `ifconfig ` and get the `eth2` ip address, that would be your access.

networks:
    - type: "public_network"
      bridge: "en1: Wi-Fi (AirPort)"
/**In your App.js*/
import Pusher from 'pusher-js/react-native';
import Echo from 'laravel-echo';

/**In your App.js, function App()*/
useEffect(() => {

        Pusher.logToConsole = true;

        let PusherClient = new Pusher('{YOUR_KEY}',{
            cluster: 'mt1',
            wsHost: '{YOUR_HOST}',
            wsPort: '6001',
            enabledTransports: ['ws'],
            forceTLS: false
        });

        let echo = new Echo({
            broadcaster: 'pusher',
            client: PusherClient
        });

        echo.channel('home').listen('NewMessage', (e) => {
            alert()
        });

    })
0reactions
okaufmanncommented, Oct 30, 2018

As of today it can work because of this PR https://github.com/laravel/echo/pull/186

Read more comments on GitHub >

github_iconTop Results From Across the Web

Connect my React Native app to Echo Device - Forums
Hi guys! My internship project is to make a React Native app that connects with Echo and sends commands to it.
Read more >
React Native + Laravel Echo using socket.io - Medium
This article focuses on integrating Laravel Echo with React Native applications. EDIT: It works not only with RN but also with every JS ......
Read more >
Create react native app that will start with voice command like ...
I am using react-native-voice inside the app to recognize what I am saying but only after I click on the app and press...
Read more >
Google Home Assistant / Amazon Alexa - React Native?
Hi guys, since any app with an audio element will have to start being developed / transpiled to work with Google or Alexa,...
Read more >
Building a Web and Voice App ecosystem (Amazon Alexa ...
Effectively, the user has a choice to interact with your system either via Alexa, Google Home or the traditional input fields in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found