Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP Websocket server in Linux hosting [closed]

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 ?

like image 936
Neil Avatar asked Jan 25 '13 06:01

Neil


2 Answers

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.

like image 84
HartleySan Avatar answered Oct 04 '22 21:10

HartleySan


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.

like image 40
Edward A Avatar answered Oct 04 '22 22:10

Edward A