I am using Socket.io for my react-native project. The nodejs server is hosted with Heroku. When I tried to connect from the app to server, it works perfectly !! But when try I emit a message, I can't see it on my receiving Reactjs site
Here's the code for react native app ->
import { io } from "socket.io-client";
useEffect(() => {
if (tried === true) {
const socket = io("wss://my-domain-name.herokuapp.com");
socket.emit("finishPayment", "true");
setScanned(false);
}
}, [status]);
Here's the receiving client side code (React js) ->
socket.on("finishPayment", (msg) => {
console.log(msg);
});
The connection is done (in the app), but the message is not emitted.
Any idea why is this happening ?
Thanks !