6

I have a GoDaddy Linux hosting , any idea how do I run a websocket server for my HTML5 web app ? Any other recommendation ?

I know VPS can do it, but it is costly , any PaaS solution ?

5
  • Are you trying to run a PHP listening server on GoDaddy? Or are you trying to run a WebSocket in Javascript? Commented Jan 25, 2013 at 6:58
  • If you are using vps you can take a look at something like node.js and socket.io. Commented Jan 25, 2013 at 8:49
  • @Chris Yes I am trying to listen in the PHP hosting I already bought. Writing clients in JS is relatively easier , given that all latest browsers support. Commented Jan 25, 2013 at 9:13
  • I know VPS is an option , but it is costly. Any PaaS solution ? Commented Jan 25, 2013 at 9:14
  • Pubnub is a great real time message service pubnub.com depending on what you are trying to do. Without the need for VPS Commented Jan 25, 2013 at 9:21

3 Answers 3

1

If you have a shared hosting plan, you will very likely not be able to access sockets, thus making it impossible to use the WebSocket API.

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

2 Comments

So in shared hosting only port 80 is available ?
That is a question which would be better suited for GoDaddy support.
1

You're going to need a virtual private server for this one.

If you got that set up you can take a look at socket.io and node.js which does exactly what you're looking for. There are a couple of examples of how to set it up on their websites plus you can take a look at this blog post which has some examples on how to set up node.js and socket.io with html5's canvas and websockets to have some realtime drawing going on.


Edit: Theres a second option of running a php based socket server, although not as good as the option above, but it can probably(?) be done without vps.

PHP has seme basic functions to create a socket server that are listed here. There are a couple of examples of how to set it up such this. And theres also this stackoverflow answer here that lists a couple of google code projects that does exactly what you need such as this.

3 Comments

VPS unfortunately costs more that the shared hosting plan I have already bought. Let me see if it can be mortised to compensate for VPS pricing .
There are companies offering cheap VPS's out there (about $10 per month for some). Might be worth looking at.
@NeilGhosh Added a VPS-less option for you.
1

The best PHP WebSocket self-hosted/install solution right now is Ratchet.

However, as stated by @HartleySan, you're unlikely to be allowed to use a WebSocket solution on a shared plan due to the requirement for persistent connections. This is especially the case with general PHP solutions that allocate a large amount of resource to each request. Ratchet may have worked around this, I don't know.

IMHO the best solution for PHP is to use a hosted service such as Pusher, who I work for. There are other realtime web hosted solutions available too. This means you offload the persistent connections to the hosted service and can use your PHP stack in the normal way.

Also related: OpenShift, a PaaS, have written an article which covers the challenges of WebSockets. This helps explain the problems that other hosting providers are having when supporting WebSockets.

OpenShift do have WebSocket support in preview so you could try them out. But that is obviously a problem if you've already paid for your shared hosting. As above, I'd recommend a hosted service as the best solution.

1 Comment

WebSockets by default will work fine only with Node.js and DIY cartridges in case of Openshift

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.