Re: Re: build a multi chat server with php

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2007-12-08 at 16:46 +0000, Nathan Rixham wrote:
> 1 - yes you can make a multichat daemon in php
> 2 - if you don't know that it's possible or where to begin, then odds 
> are you won't be able to make it.

That's what the list is for... to help him find his way.

> abderrazzak nejeoui wrote:
> > Hello,
> > i want build a multi chat server based in php.
> > 1- is that possible
> > 2- if yes can you instruct me how to bigin
> > thanks

There are two approaches. You either are looking to do it as a
standalone application outside of the web environment, or you are
looking to do it via the web environment using some combination of
backend PHP and front end browser refreshes (not recommended) or AJAX.
A simple scenario for the web version follows:

    1. User logs in (or implicitly is logged in anonymously)
    2. User sees any ongoing discussion for X amount of previous time
    3. User can post a form to the website (or post data via AJAX)
       which effectively is the user's message to the chat server
    4. Message is save to database with ID/timestamp
    5. Browser refreshes or AJAX retrieves messages greater than
       user's session message ID
    6. Return to step 1.

The session is responsible for tracking the last message ID retrieved by
the user. This could also be facilitated by the browser, but it will
almost certainly be problematic. Additionally, but having it in the
session you ensure the user can't arbitrarily jump back in time (this
may be a privacy issue if chat users only expect those logged in to ever
see their messages). Additionally when saving messages or viewing
messages you may want to track a group ID that refers to the chat forum
in which the messages are being posted/retrieved. In this way you can
have multiple chat rooms.

This should get you started or asking questions more to the point.

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux