Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Php one to one chat without RTMP

Posted on 2011-10-18
7
Medium Priority
?
452 Views
Last Modified: 2013-12-12
Hello experts , would it be consistent to develop ajax based one to one chat application with php & mysql like in facebook . I mean setting an interval that will ask for new messages via ajax and update chatbox if there is new message. Would this build work healthy ?

Or do i have to use FMS or Wowza for RTMP  ?
0
Comment
Question by:Ali Kayahan
  • 4
  • 2
7 Comments
 
LVL 14

Author Comment

by:Ali Kayahan
ID: 36993154
maeltar thanks for you reply , but i dont ask for a chat script . I just wonder would it be healthy to use settimeout or setinterval to check new messages or should we use ajax push or RTMP instead?
0
 
LVL 14

Accepted Solution

by:
Ali Kayahan earned 0 total points
ID: 36994606
Ok after googling some hours i found that ajax push  should be used for such projects. And i ll use APE (Ajax Push Engine) as its free and seems easy to use.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 14

Author Closing Comment

by:Ali Kayahan
ID: 37016599
In my question , i asked for a consistent one to one chat algorithm which is not possible to build with intervals as answerer points.
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 36999260
you can perfectly use your method and build a reasonably neat chat application, but it probably will not scale very good

if you change a little bit the algorithm so that your client is ALWAYS requesting the next line in the chat, you will end up with the same functionnality any complicated lib provides
- server-side, you need the script to wait until some input arrives
- client-side, you need to restart the polling as soon as you received the previous line
btw, all of the the so-called HTTP+js push libraries work in this way, since httpquery does not return the page's content before it receives EOF

you probably can work something better and reasonably scalable by reading the chat continuously in an (i)frame so you do not even need to restart polling between lines.
if you use this (i)frame to echo back to the user, you can as well guarantee all chat windows are the same
but then you need to work out something to make the scrollback buffer non infinite so your browser does not eat up all memory after some time
i'd go for this solution, and an additionnal meta tag so the browser refreshes the chat window from time to time, refilling it with a reasonable scrollback
you probably can work out a javascript that will trigger the refresh based on the size of the (i)frame's contents

for the record, a database is not needed to achieve this. a text file would be more than enough as long as you do not let it grow endlessly
0
 
LVL 14

Author Comment

by:Ali Kayahan
ID: 37001606
@skullnobrains: thanks for your reply , what about APE (Ajax Push Engine) ? I built a nice chat application with it .It seems consistent and also works as standalone server .
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 37025969
i never coded with it, but it looks clean and has a pretty good reputation
i like to have the same language client and server-side
if i were you i'd take a minute to check wether the http part is really HTTP and not a specific semi-strange protocol that will break if you have proxies or possibly if you want to move to a regular web server
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 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