Re: Re: build a multi chat server with php

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

 



Robert, Abderrazzak,

You make some good points, and apologies abderrazzak; I woke under stress and haven't been the friendliest today!

The Ajax method is definately a good approach, particulary if you're wanting to have the chat client within a web page.

The other approach is to make a php chat daemon, this can be achieved by running php through the CLI. To get started some reading of the PHP Manual would be advised, partculary under stream_socket_server, stream_socket_accept, pcntl_fork, the CLI section itself, and finally some catching up on php wrapeprs to stdin, stdout and stderr - stream_socket_pair may come in useful aswell.

I'd strongly recommend you follow Roberts advice to start with, and build that chat application as a standrd php app with mysql and an ajax front end (perhaps even an iframe whilst developing functionality, then upgrade to ajax).

Many Regards

Nathan

Robert Cummings wrote:
On Sat, 2007-12-08 at 12:19 -0500, Robert Cummings wrote:
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.

Should have been:

    6. Return to step 3.

Cheers,
Rob.

--
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