0
votes

I have a question which I can't seem to answer after searching for an answer on google. I have a website hosted on a web host, but I want to introduce some real-time functionality on it, like a real-time notification system, or maybe a chat system.

As I understand the short-polling and long-polling methods of simulating a live feature are kinda obsolete. Today with the modern HTML5, we can use Websockets as I understand, or APE(Ajax Push Engine). The thing is that I don't understand, how do I use websocket or APE on the webhost if they require a server to which they connect in order to work ?

How can I run that server along with my website on the same host ? Or maybe I am missing something ?

Can you give me some information on this problem, that I can read?

Thank you.

1

1 Answers

1
votes

WebSocket is just another protocol. It works on port 80, so luckly you don't need a new server.

You just need to implement an abstraction level on your backend (but maybe it can do itself) that gets the HTTP request and looks if there are the upgrade headers.

If the answer is yes, go to websocket code, if not use standard HTTP.