I’ve been trying to make this combination work. But it seems that react-native-pusher sdk it not updated to be compatible with laravel reverb yet? Can someone confirm this?
This my sample code.
import Echo from "laravel-echo";
import { Pusher } from "@pusher/pusher-websocket-react-native";
export const connectToWebSocket = async () => {
try {
const ws = new Echo({
broadcaster: "reverb",
Pusher,
key: "samplekey", // app key
host: "127.0.0.1",
wsHost: "127.0.0.1", // host
wssHost: "127.0.0.1", // host
wsPort: 8080, // port
wssPort: 8080,
enabledTransports: ["ws", "wss"],
scheme: "https",
});
ws.channel({channelName: "sample-channel"});
} catch (error) {
console.log("error socket", error);
}
};
I tried doing sample vue project and implement the same thing but using pusher-js and it’s working fine
New contributor
John Mark Ovalo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.