You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I understand, I'm listening to emit event from server, when user send new message, I write it in console.
And I have a fake button, which send a fake message to server :
this.socket.emit("message", 'hello word')
But the event never received by my server, I never see in console "new message recevied"
I really spend lot of hours to understand what is the mistake.
Can anybody helps me please ?
Thanks a lot
The text was updated successfully, but these errors were encountered:
My application is build in PHP, Flutter and React Native. We are actually moving to React Native from Flutter and we can't get get the React Native app to connect to the Socket Server so we came up with a solution to use SwoolePHP or Node.js socket.io then call our PHP apis from the Node.js Server when required.
Hi,
I'm using RN with phpsocket.io.
I can connect to socket but any emit works.
What I'm doing wrong ?
Here is my RN code :
<?php require_once __DIR__ . '/man/Autoloader.php'; require_once __DIR__ . '/io/src/autoload.php'; use Workerman\Worker; use PHPSocketIO\SocketIO; $io = new SocketIO(20200); $io -> on('connection', function($socket) { echo "connected\n"; $socket -> on('message', function($data) use($socket) { echo "new message reveived !\n"; $socket -> broadcast -> emit('new message', 'ello'); }); }); Worker::runAll(); ?>
So, on the server side, I always see "connected" in log console.
In React Native, on mount component, I write this :
componentDidMount() { this.socket = io('http://my_dns:20200') this.socket.on("new message", msg => { console.log('new message : '+msg) }) }
If I understand, I'm listening to emit event from server, when user send new message, I write it in console.
And I have a fake button, which send a fake message to server :
this.socket.emit("message", 'hello word')
But the event never received by my server, I never see in console "new message recevied"
I really spend lot of hours to understand what is the mistake.
Can anybody helps me please ?
Thanks a lot
The text was updated successfully, but these errors were encountered: