0

I have an Expo app and want to use Pusher Channels

There was react-native sdk in pusher-js library - https://github.com/pusher/pusher-js/tree/master/react-native but it seems to be deprecated, and it is recomended to use official SDK package - https://github.com/pusher/pusher-websocket-react-native But i'm facing the error bellow while trying to load my app


Error: The package 'pusher-websocket-react-native' doesn't seem to be linked. Make sure: 

- You rebuilt the app after installing the package
- You are not using Expo managed workflow
, js engine: hermes

package.json:

"@pusher/pusher-websocket-react-native": "^1.2.1",

connection:

import { Pusher } from '@pusher/pusher-websocket-react-native'

const pusher = Pusher.getInstance()

...

in useEffect:

pusher.init({
    apiKey: 'KEY',
    cluster: 'eu',
    useTLS: true,
    // authEndpoint: api.USER_PUSHER_AUTHENTIFICATION
})

I guess that this sdk is not supported by Expo.

I also tried to use pusher-js/react-native with different versions, but app fails without error, just many symbols in console

Is there any workaround to use Pusher channels with Expo?

1 Answers1

0

So because pusher uses a react native sdk you need to create (build) an expo developer build when ever you need to add native react native packages

https://docs.expo.dev/develop/development-builds/create-a-build/

use that link to build a development build for your android device and your pusher stuff would work :)