Search code examples
phpwebsocketratchet

Ratchet & Websockets - Can not get anything working


So I am fairly new to PHP and websockets and server management in general. But have been tasked with designing a web-app and have determined that the best way to implement this is with websockets. So I found ratchet. And began trying to get it to work. I have a linuxbox with apache already setup, and created a new directory in the webroot and began Ratchet's tutorial. However no matter what I did I could not get even the in-line telnet part working.

I have a composer.phar, I have their script within my composer.json, I followed their instructions for installing ratchet. however when I run the php chat_server.php command it doesn't seem to do anything. The tutorial states that it should take control of the console, and as I saw in a video tutorial it does.

So my ultimate question is - what is causing this not to run properly? Is it a bad installation (Did I mess up installing somewhere or just not install something that is required but was not explicitly stated?) all the code is identical to what is documented here http://socketo.me/docs/hello-world


Solution

  • Some questions when ratchet is not functioning while setting it up.

    • Is the php process (#php chat_server.php) open?
    • Are you telnetting from another cli?
    • can you check if the port on which the chat server should be running is allocated?(#netstat -pln)
    • Is the zmq library added to the apache modules? (Probably your problem)

    If the above aren't working you might try to check if some firewall is blocking the connection internally.

    I would suggest starting from a clean machine to execute all set up steps.