Been studying a ton on AJAX because I'm making a real-time application out of Javascript and PHP. It needs to be able to update without refreshing the page and in real-time.
I tried polling the server with setInterval() but for it to be quick I had to have it every second. It seems to be using a ton of bandwidth though. It does work however and I have a plan with my hosting provider for 'unlimited bandwidth'. It seems like a lot of stress on the site though so I wanted to use a Push technology.
Learning how to setup Push was extremely difficult. From what I managed to figure out, you have to host some type of push server or comet server. I also looked into websockets, but there too you had to host it yourself. I don't understand how to do that when I do not own a server computer and there is no documentation on my hosting providers website about this.
Do specific hosting providers host push server for you? Is there a way to get a server without having to host it? It seems like a much better choice over polling, but at the same time it seems extremely confusing.
Do specific hosting providers host push server for you? Is there a way to get a server without having to host it? It seems like a much better choice over polling, but at the same time it seems extremely confusing.
Yes, I work for Pusher who offer such a service. You can see a quickstart guide here. There are also other realtime hosted services that you could read up on.
I'd also recommend you have a look at:
My opinion, as expressed in the first link, is that PHP isn't a good technology for realtime web applications. You are best to either have different components that you use as your realtime web infrastructure. That should either be something self-installed or a hosted solution such as Pusher, who I work for. Why? PHP + Apache wasn't built for maintaining long running connections. There are PHP standalone WebSocket solutions you could look at, but you are 80% likely to be using Apache and 20% nginx which doesn't support WebSockets quite yet (but will soon). Even then, I'm not sure how they'll integrate with the standard PHP request/response application flow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With