Shkarbatov / WebSocketPHPRatchet

WebSocketPHPRatchet
6 stars 1 forks source link

can't get worker to output on message #1

Open cpgb85 opened 5 years ago

cpgb85 commented 5 years ago

I copied your code exactly, everything works except this piece on the controller.php

$conn->on('message', function($msg) use ($conn)

it doesn't seem to trigger anything

Shkarbatov commented 5 years ago

Difficult to say what's wrong, because I didn't see your code. Don't you forget to run composer install? Maybe this will help you: http://slides.com/jamesjason/deck-13#/12

cpgb85 commented 5 years ago

No i didn't forget to run install composer. The script wouldn't run if i didn't do that because the library wouldn't be downloaded. What makes it all the more confusing is how does it listen for anything if the connection is stopped ?

Shkarbatov commented 5 years ago

if connection is stopped - you can't listen anything. Or what you mean under connection is stopped?

$conn->on('message', function($msg) use ($conn) This part will run if your controller receive a message through the web socket. There no full example how this part works in my code, I want only to show that you can do this with ratchet.

If you will tell me what exactly you need, maybe I can help you.