0

Any idea how to implement this (http://fluin.com/63) using MySQL+PHP+Javascript(mootools)?

In a nutshell, it's a realtime threaded conversational web app.

Update:

This uses http://www.ape-project.org/home.html

Any idea how to implement realtime stuff without AJAX push (ape)?

Bill the Lizard
  • 369,957
  • 201
  • 546
  • 842
Hirvesh
  • 6,440
  • 14
  • 51
  • 70
  • should be simple ajax, right? – WarrenFaith Jan 28 '11 at 11:53
  • You lost your question because you created another cookie-based account. I've merged, but consider registering. –  Jan 28 '11 at 13:27
  • Why are you asking this question again and again http://stackoverflow.com/questions/4827204/implement-fluin-com-without-ape-server ? – osm Jan 28 '11 at 15:39

4 Answers4

1
  1. Install Firefox.
  2. Install Web Development toolbar
  3. Install Firebug
  4. Install HttpFox
  5. Read docs of above tools re how to use, what they can do.
  6. Go to http://fluin.com/63. Use above tools to inspect.
  7. Read up on Databases and data models, and MySQL.
  8. Build your own.
Richard H
  • 34,219
  • 33
  • 105
  • 133
0

Well, this depends on your definition of realtime, which, in its technical meaning, is simply impossible with public ip networks and traditional tcp stack, for you have no control over timing.

Closer to the topic though, to get any web page updated without direct user intervention, you'd have to use javascript to poll server for changes since the last successful poll, and do this over certain intervals of time. In calculating these intervals you'll have to consider both network/server load, and the delay that is comfortable for the user.

The server, of course, will have to store the new data and its timely status (creation timestamps are one way of doing it), to be able to distinguish between content already delivered to various clients.

As soon as the server reports new content, it is inserted into a dom page via javascript and the user sees the response.

This is a bit general, of course, but you should get the idea.

Dennis Kreminsky
  • 2,049
  • 13
  • 23
0

Isn't it like a shoutbox ? here an example of one

Clyde Lobo
  • 8,747
  • 6
  • 34
  • 58
0

Doing this properly using PHP only is very hard. When you have 5 users you could use long-polling, but it will definitely not scale when you have let's say 1000 users.

The screencast(link) in my post shows how you could implement it, but it has a couple of flaws:

  • It touches the disc(disc is very slow compared to memory).
  • To make matters worse it also polls the disc frequently(filemtime()).

Maybe phet(PHP) is able to scale. You should try that out.

To make it scale I think you need at least:

  • a good implementation of long-polling(at least long-polling. You have better transports) that can handle load.
  • keep data in memory(much faster than dics) using something like redis or memcached.

I would use:

Community
  • 1
  • 1
Alfred
  • 56,245
  • 27
  • 137
  • 181