Closed JoshIPT closed 5 years ago
The output on the server side shows:
New client connected
Got message: {"ip": "10.100.12.194", "cmd": "meep"}
Sending: {"rx":"10584","tx":"6744"}
Sending: {"rx":"3504","tx":"7136"}
Sending: {"rx":"3504","tx":"7136"}
.........
None of those messages are received.
$tik->loop()
is a blocking call. Script execution will hang there and remain inside the RouterOS client. Ratchet will not be able to send or process messages as it relies on its own React event loop.
I am not sure if there are ways to make them compatible with each other. One possibility is to run $tik->loop()
periodically from the React loop with a timeout specified.
Basic app written based on the helloworld example, with modifications. The server seems to listen and receive messages just fine, but send() is never received by the browser?
This is my server-side code:
Client side code is just as the sample on the documentation:
And then sending a message via:
conn.send('{"ip": "10.100.12.194", "cmd": "meep"}');
Message is received. JSON decoded. streamNTD is initialised, does what it needs to do and calls send() with the JSON to send back but this message is never received. I have done a var_dump() on the send call and got a valid object back.
Ideas?