What do you suggest?

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
User avatar
silvercover
Forum Newbie
Posts: 10
Joined: Thu Sep 20, 2007 10:17 am

What do you suggest?

Post by silvercover »

I have to make a website for local restaurants to let people order foods online. I decided to make this system real-time. In other words, i want it to notify restaurant kitchen about new orders synchronously (at least almost). What i have in my mind is to make a program ( we call it messenger ) to check server periodically with default or custom intervals. for example it should check database for new orders every 30 seconds. When i look at this solution, it comes to my mind that there must be better solutions which i am not aware of! so i came here to ask you guys what is the best solution for this?

My ideal solution is to have notifying mechanism like what we see in Instant messenger like Yahoo Messenger. As you know when you receive new email, YIM notifies you by showing a message and this not based on client side checking system that i mentioned in first paragraph.

Thanks in advance.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

Wouldn't you just add the notification code to the application that updates the database? I don't see why you would need a timed database access.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Comet
(#10850)
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post by Maugrim_The_Reaper »

What arborint said ;).

Comet is a server-push model. Once the initial HTTP response is received by the client (using AJAX), the connection is maintained to push new data immediately to the client. So long as the number of maintained connections is not too many it scales fine - might want to run it from a separate subdomain since most browsers/clients only allow a limited number of connection per domain.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Hey silvercover, there is a PHP Comet demo here, but I clicked on the demo link and it did not work. Why don't you get that demo code working and post the fixed code and your thoughts here. I think other members would be interested in that.
(#10850)
User avatar
silvercover
Forum Newbie
Posts: 10
Joined: Thu Sep 20, 2007 10:17 am

Post by silvercover »

Thank you guys for your great info. I am studying Comet model as much as i can.

@arborint,

Let me see that source and examine it. :)

@califdon,

I know about this, but imagine the situation that you forced to use instant messaging model. i also thought about email to fax, email to SMS and similar methods including sending simple email message. The most effective solution for our needs is instant messaging. On the other side we
want to bring new experience for customers and let them keep in touch with restaurant and track their orders via that Messenger i mentioned.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

silvercover wrote:Let me see that source and examine it. :)
Great. I just don't have time right now to look into why it wasn't working (there is a chat demo on that page too). If you can figure out the problem, but narrow it down a little, post the code here and we can pitch in to get a working demo. I think that would benefit everyone here interested in this subject.
(#10850)
Post Reply