Solved

Creating realtime online auction and communication system for multiple users

Posted on 2015-01-10
12
72 Views
Last Modified: 2015-04-16
My task is to create a realtime online auction and communication system for an auction house. They are running a floor auction, but also inviting bidders to participate online by logging into their website and "watching" the auction in realtime, with the option to place a bid, etc.

I've got the majority of this task covered. Users will login and be tracked with a session cookie. The administrator will have a special login that allows them to control the auction, specify which lot is current, enter floor bids, type communications to bidders, etc.

When the administrator (or any other user) does some action, it will send a jQuery/AJAX request to the server and update a database. So the database will always contain the current "state" of what is going on with the auction. The administrator can also send and receive private messages to/from bidders (or the whole group), those would also go to a database.

My question is: how do I best setup this app so that users can receive information in the smoothest, most "realtime" fashion possible, from a conceptual standpoint? Sending data seems like the easy part, but updating the user's screen is what I need to figure out. It seems that I am basically building a chat room, with some specific add-on capabilities related to displaying lot information and pictures, ability to place a bid, etc.

My first thought is to use timers of some kind. Have the user's computer poll the server every X number of seconds, grab the latest set of chat messages (for example), figure out if anything has changed, and if so update the user's screen. But I obviously need to account for network lag, so I can't guarantee this will happen every X number of seconds.

Is there a smoother, more modern way to accomplish this?

Also, the administrator will control a countdown, so that a lot will close in (for example) 12 seconds. Somehow the current "count" needs to be distributed to everyone who is logged in. And if a floor bid is placed, the count is reset to 12 seconds again. Should the server contain the "master" countdown? Or the administrator's computer? How best to distribute this countdown to all users?

I'm obviously not looking for code here. I think I have the skills to create this system, just looking for some advice on how best to approach this.

Thank you!
0
Comment
Question by:bbdesign
  • 6
  • 5
12 Comments
 
LVL 8

Expert Comment

by:Ahmed Merghani
ID: 40542230
Hi bbdesign,

Maybe "XMPP" protocol is what you are searching for. See this link:
http://en.wikipedia.org/wiki/XMPP

regards,
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 40543008
Along the lines on what Ahmed has said, I would look at Websockets.  This would allow your server to push out data at realtime to your clients

http://caniuse.com/#feat=websockets Shows compatibility with all the major browsers, including mobile if you're thinking responsive
http://www.html5rocks.com/en/tutorials/websockets/basics/ Explains basically what they're about.
0
 

Author Comment

by:bbdesign
ID: 40544167
It sounds to me that, since I have no experience with these different protocols, and I have to build a real project for a client in the next few months, I should look to an API or software library. Looking at the URLs you provided, so far I have found these:

http://socket.io/
https://pusher.com/

This sounds like the way to go? Any others I should be looking at? I only need this to work on a browser for now, not a mobile app or anything like that.

Thank you.
0
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 40544181
I haven't built anything using websockets yet so I can't recommend one over the other, however I suspect it will be the server side code that will do most of the grunt work.

As you can see, there are even websocket plugins that work natively with jQuery (https://code.google.com/p/jquery-websocket/) to just send and receive JSON data so I don't think the browser is the issue here.  I had a quick browse at the links you found but I'll ask you the question, do they fit the bill server side for you?
0
 

Author Comment

by:bbdesign
ID: 40544208
Good question. The site I am building this on runs MIcrosoft IIS and MIcrosoft SQL Server. I will have to look into how the server side would function. My thinking is that the admin would send messages, those would get stored in a database, and then "something" would send messages to the client computers (auction bidders who are logged in) based on whatever activity is going on.
0
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
ID: 40544246
Certainly the easiest approach is the polling scenario, where the browsers hit your servers with requests but this could generate an enormous load, as you could imagine.

EE uses websockets to push notifications so we know it can be done :)

I would approach this in a way to keep it as simple as possible. You've seen how simple the client can be (from my previous post), the server socket program should be the same. Registers "listeners" when they connect, and sends data to those connections when instructed. A middle man if you will. It means that the server side can be polling for changes (if it can't be notified directly), which is a lot less overhead than having every client do it.
With the websocket method you would need to have some kind of authentication relating to a valid session, going back and forth to ensure bids are kept private etc.
0
 

Author Comment

by:bbdesign
ID: 40544582
The somewhat pre-built tools such as:
http://socket.io/
https://pusher.com/
... I think those use WebSockets, with fallback mechanisms. I need to research them more thoroughly to see which (or if any others) would be the best fit.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 40552421
That's correct.  Let us know how you go.
0
 

Author Comment

by:bbdesign
ID: 40553717
I was talking to a colleague today, he recently used this, and was strongly recommending it:
https://www.firebase.com

He claims its the coolest thing out there of its type.
0
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
ID: 40554451
It does look pretty cool.  How does your budget look regarding its pricing? https://www.firebase.com/pricing.html

This is the issue sometimes being a developer because you have to weigh up the cost of buying something off the shelf versus cost of developing (and maintaining) it in-house.
0
 

Author Comment

by:bbdesign
ID: 40554515
I did not, but thank you for pointing that out.
0
 

Author Comment

by:bbdesign
ID: 40727550
For this particular project, we are going with Firebase. The client doesn't have a problem paying the fee, and their software really took a huge chunk out of the programming time I would have to put in. Thanks for all the advice.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Capture logon name 13 70
Button to go back 3 24
Adding Row and Cell on a table 14 13
Make options hidden and show just option that is on 1 10
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question