SitePoint Sponsor

User Tag List

Results 1 to 13 of 13

Thread: Chat Window

  1. #1
    SitePoint Zealot
    Join Date
    Jun 2008
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Chat Window

    I am PHP coder. I am badly posting in this forum because I know almost nothing about javascript.Few days ago I got javascript's manual I mean the mozilla's javascript tutorial.

    Now I need codes for chat window like you have seen the facebook small window chat under that page or the gmail small window chat which updates messages without refreshing the page and shows message almost instantly. I think this work can been done with javascript.

  2. #2
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You need to learn about XMLHttpRequest and AJAX. That's how it's done.

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,805
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you're looking to do it yourself then write it in PHP and get it working then you can add all the JavaScript/AJAX stuff later.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  5. #5
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JimmyP View Post
    If you're looking to do it yourself then write it in PHP and get it working then you can add all the JavaScript/AJAX stuff later.
    You could do it either way. If you have a clear idea of the client application architecture, you can write that first then write the server scripts that respond to the AJAX requests. Definitely do not rely on the client while debugging the server scripts though. Use Firebug to make sure your server scripts are printing what you expect them to.

  6. #6
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A chat web application is possible without the use of JavaScript so it would make sense to make it in such a way and then enhance it's speed/appearance with the use of JavaScript/Ajax.

    Quote Originally Posted by World Wide Weird View Post
    You could do it either way. If you have a clear idea of the client application architecture, you can write that first then write the server scripts that respond to the AJAX requests. Definitely do not rely on the client while debugging the server scripts though. Use Firebug to make sure your server scripts are printing what you expect them to.
    I agree. The main reason I suggested doing it in PHP before touching client-side scripting was because the OP said he didn't know any JS.

    When building this type of app it is important to get the server-side architecture spot on and not get carried away by front-end sparkle.
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  7. #7
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JimmyP View Post
    A chat web application is possible without the use of JavaScript so it would make sense to make it in such a way and then enhance it's speed/appearance with the use of JavaScript/Ajax.

    I agree. The main reason I suggested doing it in PHP before touching client-side scripting was because the OP said he didn't know any JS.

    When building this type of app it is important to get the server-side architecture spot on and not get carried away by front-end sparkle.
    The old-style HTML chats are dull and cumbersome and, IMHO, not worth doing anymore. If you're going to do IM over HTTP these days, it's pretty much a given that JavaScript and AJAX will be involved. I don't think it's correct to regard the client application as mere window dressing or "sparkle". JavaScript has come a long way since the days of flying headlines and similar cheesy effects. The client is a real application and very much integral to the IM experience. Users will either have to accept the fact that they need a modern browser with JavaScript enabled to use these applications, or else do without them.

  8. #8
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok I understand where you're coming from, but why make it solely a JS application when having it fallback to non-JS functionality is perfectly possible?

    And I know that JavaScript is so much more than icing on a cake nowadays but that doesn't change the fact that when building applications, making them as cross-platform-compatible as possible is very important! Not everyone who has JavaScript disabled chooses to have it that way.

    It annoys me that people put web "applications" into a different class as regular websites. They both require and use the same technologies and run on the same platform so why is it any less important to ensure graceful degradation on a web app than on a regular website?

    I don't care about the "new wave" of web applications - I care about my users and I care that all of them (or the vast majority) can access the core functionality of a website, regardless of what browser they're using or what technologies it supports. < This is obviously an unrealistic view and so is not normally possible so I'll accept that users of lower capability browsers will have a degraded user experience... But there is no reason why they should get *NO* user experience ... At least, give them something, even if it is a dead-slow request-by-request chat application with no Ajax.

    The old-style HTML chats are dull and cumbersome and, IMHO, not worth doing anymore
    IMHO It is worth doing if a significant amount of your users do not have the technologies required to experience a speedy JS chat app.

    JavaScript has come a long way since the days of flying headlines and similar cheesy effects.
    Really? AFAIK the JavaScript language has not changed a massive amount in the last few years. The way people use it has obviously changed though...
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)

  9. #9
    SitePoint Zealot
    Join Date
    Jun 2008
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well well, so you all are advising me to use a php-ajax chat script?

  10. #10
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,805
    Mentioned
    157 Post(s)
    Tagged
    3 Thread(s)
    pretty much.
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  11. #11
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by coolR View Post
    Well well, so you all are advising me to use a php-ajax chat script?
    I am. JimmyP appears to disagree, and his arguments concerning the degradeability of the app do have merit. I am not convinced that a significant number of users lack the browser capabilities needed for a full AJAX chat though. As far as I know, every major browser can be downloaded for free.

    Your server-side app doesn't necessarily have to be PHP. You can get the same results with your preferred language/platform.

  12. #12
    We're from teh basements.
    Join Date
    Apr 2007
    Posts
    1,205
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by JimmyP View Post
    It annoys me that people put web "applications" into a different class as regular websites.
    But they are a different class. A regular Web site is a stateless entity that conforms to the inherent RESTfulness of HTTP. Once you undertake to emulate a stateful desktop application, you've automatically thrown REST out the window.

    Quote Originally Posted by JimmyP View Post
    Really? AFAIK the JavaScript language has not changed a massive amount in the last few years. The way people use it has obviously changed though...
    That's what I meant. Now who's picking nits?

  13. #13
    SitePoint Zealot
    Join Date
    Jun 2008
    Posts
    192
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by World Wide Weird View Post
    Your server-side app doesn't necessarily have to be PHP. You can get the same results with your preferred language/platform.
    I am editing an auction script which is written in php and some javascript.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •