Linux Websocket Server on Linux Hosting

I have a GoDaddy Linux hosting, any idea how to start the websocket server for my HTML5 web application? Any other recommendations?

I know VPS can do this, but it's expensive, any PaaS solution?

+6
source share
3 answers

If you have a shared hosting plan, you will most likely not be able to access sockets, which makes it impossible to use the WebSocket API.

+1
source

To do this, you will need a virtual private server.

If you get this setting, you can take a look at socket.io and node.js , which does exactly what you are looking for. There are some examples of how to configure it on your sites, and you can take a look at this blog post which has some examples of how to configure node.js and socket.io with an html5 canvas and websites to continue drawing in real time .


Edit: Theres the second option to start the php-based socket server, although not as good as the option above, but it can probably (?) Be done without vps.

PHP has basic seme functions for creating a socket server, which are listed here . There are several examples of how to set up this one . And here is also this fooobar.com/questions/935992 / ... , which lists several google code projects that do exactly what you need, like this .

+1
source

The best solution for self-hosting / installing PHP WebSocket right now is Ratchet .

However, as pointed out by @HartleySan, you are unlikely to be able to use the WebSocket solution in general terms due to the requirement of persistent connections. This is especially true for generic PHP solutions that allocate a large amount of resources for each request. Perhaps Ratchet got around this, I don't know.

IMHO the best solution for PHP is to use a hosted service such as Pusher , which I work for. There are other real-time web hosting solutions . This means that you unload persistent connections to the hosted service and you can use your PHP package in the usual way.

Related: OpenShift, PaaS, wrote an article in which WebSockets problems . This helps explain the problems that other hosting providers have when supporting WebSockets.

OpenShift has WebSocket support in preview, so you can try them. But this is obviously a problem if you have already paid for your shared hosting. As above, I recommend the hosted service as the best solution.

+1
source

All Articles