Search code examples
phpjavascriptshellwebsocketphpwebsocket

phpwebsocket not working


This is the tutorial I used:

http://www.flynsarmy.com/2012/02/php-websocket-chat-application-2-0/comment-page-1/#comments

Basically I downloaded the source code, placed the files in a folder: http://mmhudson.com/ws

server.php: http://mmhudson.com/ws/server.php

I simply can't get it to connect. I tried running server.php from both the command line and the browser and both times it wouldn't connect. The ws folder has all the files in the downloadable source included.

Any ideas of what I can try?


Solution

  • I think I found the solution. You are opening a connection to localhost/127.0.0.1. As soon as you put the code on a server, you'll have to specify the server URL instead of localhost/127.0.0.1 for the client. I tested the server.php and it is working fine, only the client doesn't connect to it.

    Try this for index.html

    Server = new FancyWebSocket('ws://mmhudson.com:9300');