3

http://www.bidzinga.com/

http://www.bidbass.com/

Are they using COMET technology?

What do you recommend to use, and probably a simple description on how to implement it using the suggested technology/ies?

Ram
  • 3,092
  • 10
  • 40
  • 56
bman
  • 3,740
  • 9
  • 34
  • 40

5 Answers5

7

Hi what ajax technology does these sites use?

I did a quick inspection of Bidzinga's source-code and it looks like they are doing just simple polling(frequently!). For example in this javascript file(http://www.bidzinga.com/js/default.js) I show part which does polling frequently:

setInterval(function(){
                var gettime = '/gettime.php?' + new Date().getTime();
                $.ajax({
                    url: gettime,
                    success: function(data){
                        bidOfficialTime.html(data);
                    }
                });
            }, 1000);

This is a pretty bad approach if you ask me and will kill your server under load. If this server which as you can see is using PHP(/gettime.php) does not have APC(You need to at least install/compile this for good performance) then you you can bet the server can't cope, because every time PHP needs to compile bytecode. Also it needs to get every request from disc(sometimes cached) when not using APC or any in-memory database (Redis, Memcached). Even though polling in frequent intervals is never a smart approach and you can be sure your server will die under the load.


Are they using COMET technology?

Bidzinga is NOT using COMET, because it uses plain polling.

What do you recommend to use, and probably a simple description on how to implement it using the suggested technology?

I guess it depends on your scale(size).

Hosted solution

but I think in the beginning I would recommend you to use pusher because it is a hosted solution which is pretty good documented and even has a free plan.

Our free Sandbox plan includes up to 20 connections and 100,000 messages per day

I have to remind you that the free/cheap plans do NOT have SSL so you should NEVER send any private information over the wire. The bigger price plans do have SSL, but will cost $50 monthly. I think you can go cheaper if you implement this yourself, but then again that will cost you time(time equals money). Here are some other hosted solutions which might fit your bill:

Open-source products:

First off I would like to mention that none of these are PHP, because I don't think PHP is designed to handle this. Even Facebook which was an entirely PHP-shop(now uses HipHop a lot) agrees with me and implemented chat using erlang. For these open-source products which are pretty good documented you are going to need to a VPS. For some of them it is really nice if you can install software as root. While a VPS is not really needed for all these products, but you should have the ability to compile software.

Community
  • 1
  • 1
Alfred
  • 60,935
  • 33
  • 147
  • 186
  • You may want to mention WebSockets, as many of your proposed solutions (pusher, socket.io) support it. – igorw Jul 09 '11 at 13:33
  • That's true, but if they only supported websockets you would have a big problem, because not all browsers yet support websockets. They provide more transports to have cross-browser support.. – Alfred Jul 09 '11 at 15:17
  • 1
    Hi Alfred, off course PHP is not designed to handle such but having php as the client to these frameworks would be awesome. – bman Jul 09 '11 at 17:18
  • @Geocine, the quickest way to get started is to use pusher. They have nice rest API. There is also a library developed for PHP => http://github.com/squeeks/Pusher-PHP. Maybe when I have some time I would like to wrap a simple rest API around socket.io ;). But that will still take some time I guess. My guess is that I could have something cool in a month. If I work quickly couple of days, week... – Alfred Jul 09 '11 at 17:35
  • @Alfred, your suggestion using Pusher is great but I would rather prefer a self hosted solution an opensource one. I don't have money to roll out such. So can socket.io be used for PHP where php is a client or js, that's what I have so far from your linked post haven't dig deeper. Do you recommend socket.io,node.js,redis and PHP combo ? would It not require to learn too much. Thanks! – bman Jul 09 '11 at 17:59
  • @Geocine that's the way to go ;). You can synhronize data between socket.io / PHP via redis's pubsub semantics for example. – Alfred Jul 09 '11 at 18:23
  • @Alfred thanks for the heads up any interesting resources to get started with? :) – bman Jul 10 '11 at 04:09
  • @Geocine let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/1300/discussion-between-alfred-and-geocine) – Alfred Jul 10 '11 at 09:28
  • @Alfred our chat discussion is nowhere to be found so i'll comment here just letting you know that i'm still here – bman Jul 27 '11 at 06:30
  • @Geocine I have not been in the chat for a couple of days, because I was busy. But I will continue my work on prototype ;). You can add my to XMPP if you like. My JID is alfredwesterveld@jabber.org – Alfred Jul 27 '11 at 07:16
1

setInterval will kill your server/client for every second update.

for this you can use recursive function

    //call foo onload
    foo();

    function foo(){

    // ajax call

    $.get('server.php', function(data) {

    var recursivecall= setTimeout(function(){

    foo(); // recalling

    },1000);

    });
}

You can abort recursivecall at any point of time if necessary using clearTimeout(recursivecall);.

Gowri
  • 16,587
  • 26
  • 100
  • 160
0

You can use node.js and socket.io for this. http://yoramkornatzky.com/2013/07/20/real-time-auctions-with-node-js/comment-page-1/#comment-55 this link can take you to a good start. If you are new to node and socket.io let me know.

Abhishek Kaushik
  • 1,121
  • 1
  • 13
  • 17
0

I am the developer for pennyauctionsoftware.net, we have a product that is tested to 12000 concurrent users using websockets and an ajax fallback for older browsers...it leverages cache heavily using memcache, redis and browser cache

0

They poll server each second to check/re-render time and get new data. It's classic ajax with setInterval

setInterval(function(){ get_new_data(); }, 1000);
genesis
  • 50,477
  • 20
  • 96
  • 125
  • 1
    Sure they poll each second? Would kill the server/client? I know about about system pulling every 3-10 seconds and the client generates fake data for those "timeouts" when nothing is requested from the server. – Julius F Jul 09 '11 at 12:23