6

A few days ago I setup this WebSocket server from http://code.google.com/p/phpwebsocket/

It works excellent on my localhost by using Xampp. Then, I uploaded it to my webspace on Strato, but now I am not able to connect to the server.

I changed the the sockets connection to my domain but it didn`t work

Client.html:

var host = "ws://xxxxxxxx.com:12345/Websocket/server.php";

Server.php:

$master  = WebSocket("xxxxxx",12345);

I already tried it with different port(80,443,12345,8080,8000....), using the IP address in server.php instead of the domain.

I also used absolute and relative paths in the client.html.

From the projects page http://code.google.com/p/phpwebsocket/ someone suggested to use 0 or 0.0.0.0 in the server.php, but that didn`t work either.

In the client.html it just shows:

WebSocket - status 0 Disconnected - status 3

My guess that the problem is that Strato is blocks me from using WebSockets. Is it possible to run WebSockets on my webspace?

11
  • in the client windows it just shows me : WebSocket - status 0 Disconnected - status 3 Commented Dec 8, 2012 at 14:00
  • Did you consider using node.js and socket.io? Commented Dec 8, 2012 at 14:01
  • no I havent thought about that yet. If i cant get it work i need to switch anf give node.js maybe a try Commented Dec 8, 2012 at 14:03
  • And you're sure the client machine has the appropriate ports open too? Commented Dec 8, 2012 at 14:10
  • 2
    Get a network analyzer and figure out what's really going on over the wire; find out where your PHP error log is and examine it for possible issues. Add anything you find to your question and we might be able to help, however the people you should check with are Strato. Commented Dec 8, 2012 at 15:06

2 Answers 2

4

My bet is that your host is blocking incoming requests to the socket. Your not supposed to run scripts like phpwebsocket within a web service (it is a server itself). This confuses a lot of people since PHP is typically used for scripting webpages, not for coding daemons.

I say this because you mentioned running the script within Xampp, and referred to your hosting service as 'webspace'.

If this is the case you will have to upgrade to a virtual server package so that you can run your own services.

Sign up to request clarification or add additional context in comments.

Comments

3

Okay, to bring this to an end.

I found a solution to use my websockets app and I´ve got an explanation why it did not work on my shared hosting solution.

I contacted Strato who told me that they don`t allow Websocket on shared hosting. The only way to get a similiar result would be to use AJAX Long Pooling.

Now I purchased to a Virtual Server and my websocket app works great now.

Thanks for your support.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.