Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #4975 > unrolled thread

chat on web, Ajax ?

Started by"sl@exabyte" <sb5309@hotmail.com>
First post2012-02-24 21:59 +0800
Last post2012-02-26 04:54 +0100
Articles 6 on this page of 26 — 11 participants

Back to article view | Back to comp.lang.php


Contents

  chat on web, Ajax ? "sl@exabyte" <sb5309@hotmail.com> - 2012-02-24 21:59 +0800
    Re: chat on web, Ajax ? "sl@exabyte" <sb5309@hotmail.com> - 2012-02-24 22:15 +0800
      Re: chat on web, Ajax ? Captain Paralytic <paul_lautman@yahoo.com> - 2012-02-24 06:20 -0800
        Re: chat on web, Ajax ? "SL" <sb5309@hotmail.com> - 2012-02-24 23:52 +0800
          Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-24 15:59 +0000
            Re: chat on web, Ajax ? "SL" <sb5309@hotmail.com> - 2012-02-25 00:23 +0800
              Re: chat on web, Ajax ? Doug Miller <doug_at_milmac_dot_com@example.com> - 2012-02-24 16:52 +0000
                Re: chat on web, Ajax ? "sl@exabyte" <sb5309@hotmail.com> - 2012-02-25 10:01 +0800
      Re: chat on web, Ajax ? "M. Strobel" <sorry_no_mail_here@nowhere.dee> - 2012-02-24 16:22 +0100
    Re: chat on web, Ajax ? Erwin Moller <erwinmollerusenet@xs4all.nl> - 2012-02-24 15:28 +0100
      Re: chat on web, Ajax ? Tim Streater <timstreater@greenbee.net> - 2012-02-24 14:51 +0000
        Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-24 15:54 +0000
          Re: chat on web, Ajax ? Tim Streater <timstreater@greenbee.net> - 2012-02-24 19:02 +0000
            Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-24 21:06 +0000
              Re: chat on web, Ajax ? Tim Streater <timstreater@greenbee.net> - 2012-02-24 21:38 +0000
                Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-24 21:51 +0000
                  Re: chat on web, Ajax ? Tim Streater <timstreater@greenbee.net> - 2012-02-24 22:26 +0000
                    Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-25 13:15 +0000
                      Re: chat on web, Ajax ? Tim Streater <timstreater@greenbee.net> - 2012-02-25 13:20 +0000
                        Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-25 13:33 +0000
                          Re: chat on web, Ajax ? Tim Streater <timstreater@greenbee.net> - 2012-02-25 13:42 +0000
      Re: chat on web, Ajax ? "SL" <sb5309@hotmail.com> - 2012-02-25 00:31 +0800
    Re: chat on web, Ajax ? The Natural Philosopher <tnp@invalid.invalid> - 2012-02-24 15:48 +0000
    Re: chat on web, Ajax ? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2012-02-24 17:27 +0100
    Re: chat on web, Ajax ? Jeff North <jnorthau@yahoo.com.au> - 2012-02-26 00:13 +1100
    Re: chat on web, Ajax ? Arno Welzel <usenet@arnowelzel.de> - 2012-02-26 04:54 +0100

Page 2 of 2 — ← Prev page 1 [2]


#5006

FromTim Streater <timstreater@greenbee.net>
Date2012-02-25 13:42 +0000
Message-ID<timstreater-8C2F02.13421525022012@news.individual.net>
In reply to#5005
In article <jianvj$pb8$1@news.albasani.net>,
 The Natural Philosopher <tnp@invalid.invalid> wrote:

> Tim Streater wrote:
> > In article <jiamso$n31$1@news.albasani.net>,
> > The Natural Philosopher <tnp@invalid.invalid> wrote:
> > 
> >> Tim Streater wrote:
> > 
> >> > I also found something called daemonize that allows me to write a 
> >> daemon > as a PHP script but have it run as a proper background daemon.
> > 
> >> well you can always attach a script to inetd..for low volume use.
> >>
> >> And a C style daemon is not the worst programming job in the world..
> >>
> >> I've been mixing C and PHP recently, and to be honest there is not a 
> >> great deal of difference in coding time. And once you have a makefile 
> >> source->binary for small projects is not much slower than saving a php 
> >> file :-)
> > 
> > Must be 20 years since I wrote any amount of C.
> 
> well I was feeling like that too. It all came back fairly quickly, and I 
> realised how much I missed PROPER strong typing..

:-)

Ha! I don't miss it at all - but then I'm a lazy sod.

-- 
Tim

"That excessive bail ought not to be required, nor excessive fines imposed,
nor cruel and unusual punishments inflicted"  --  Bill of Rights 1689

[toc] | [prev] | [next] | [standalone]


#4989

From"SL" <sb5309@hotmail.com>
Date2012-02-25 00:31 +0800
Message-ID<ji8e1l$ckn$1@news.albasani.net>
In reply to#4979
> That is the problem: typical http requests data from some server, and
> after it arrives, that's it.
> A normal http request:
> 1) Browser sends request to server.
> 2) server answers
> the end.
> How to let the browser listen to the server?
>
> Short answer: You cannot. Not without some tricks or additional
> software (Java, Flash for example).
>
> Read up here first:
> http://en.wikipedia.org/wiki/Push_technology#HTTP_server_push
>
> You can see on that page that a few experiments have been tried, but
> none of them if fully reliable.
> For example: multipart/x-mixed-replace is not supported by IE, and I
> don't know about mobile devices.
>
> You have 2 options:
> 1) Make a client-pull approach, eg with XHR ("Ajax").
> http://en.wikipedia.org/wiki/XMLHttpRequest
> Advantage: Easy to implement.
> Drawback: All the connected clients will be sending update-requests
> all the time. This will lead to extra serverload which can kill the
> server if you have many clients trying to chat.
>
> 2) Use additional software that CAN listen.
> Problem: See former thread: Suppose your server wants to PUSH new data
> to some client: How to deliver that behind a firewall/NAT? To which
> port?
....
....

Yahoo has a messenger that is implemented on web; one can see it after 
logging in to check mail.

With such serious shortcomings, I suppose they have to have a larger server 
farm to take care of the load from chatting.

:-) :-)

[toc] | [prev] | [next] | [standalone]


#4983

FromThe Natural Philosopher <tnp@invalid.invalid>
Date2012-02-24 15:48 +0000
Message-ID<ji8bh3$6k0$1@news.albasani.net>
In reply to#4975
sl@exabyte wrote:
> Hi folks.
> 
> I thought I have gathered all pieces I need, then suddenly I realise there 
> is still one problem.
> 
> I am implementing chat on the web, ie on a browse. On browser, I can only 
> use javascript. 
You coudl poll the server using a whole page or a framethereof.

Thats all javascript does, but it does it a bit more efficiently.

So the problem is what method to use to listen for incoming
> data.
> 
> Ajax ? I am just wondering; Ajax does not seem to bother about port, I mean 
> the standard method is "open socket at server, port 8888...".
> 
so?
> Of course, when data is sent to a php file on server, it must be port 80.
> 

not always.

Yiu can specify any port you want in a url.

General form of url is

"Http:" - the protocol to use
"Mywebserverg.org" a resolvable dns location on the internet.
"/mydirectory.myfile.ext" where on the server teh file is (virtually) 
located and some hints in ext as to how the file is to be processed 
before being sent
"?param=value&param2=valeu2..." GET variables to be passed to the script 
if any
":port number" the port to connect to at the remote end.


So you can set up a web server on any port you like and access it with a 
special URL.


> Is this the only way on a browser ?
> 

All methods are essentially polling and client initiated. The 
differences lie in what mechanism you use to poll, and how much of the 
page or frame you download.

So at the crudest end a meta refresh tag will reload the whole page, or 
a frame within a page.  A javsacript reload can do te same, but it can 
request and even smaller block of data and rebuild part of te page with it.

Ajax is just a way of doing that with  a bit less overhead IIRC.

All can be vectored to any server port you like.

> Thanks.
> 
> 

[toc] | [prev] | [next] | [standalone]


#4988

FromThomas 'PointedEars' Lahn <PointedEars@web.de>
Date2012-02-24 17:27 +0100
Message-ID<1820235.7NaK4W3vae@PointedEars.de>
In reply to#4975
sl@exabyte wrote:

> I am implementing chat on the web, ie on a browse. On browser, I can only
> use javascript. So the problem is what method to use to listen for
> incoming data.

The most compatible approach is to poll the server for new messages 
regularly.  How to do that is on-topic in comp.lang.javascript.  Useful 
answers on Usenet are more likely if you post under your real name.
 
> Ajax ? I am just wondering; Ajax does not seem to bother about port,

You are mistaken.  BTW, "Ajax" is a misnomer; thinking "XMLHttpRequest" 
instead will get you further.

> I mean the standard method is "open socket at server, port 8888...".

No, it is not.

> Of course, when data is sent to a php file on server, it must be port 80.

No, it does not have to.

> Is this the only way on a browser ?

There is also the Comet approach, and there are Web Sockets.  However, the 
latter has security issues and is not well supported as of yet.

Your problem in general is on-topic in comp.infosystems.www.authoring.misc, 
not here.  You should have known already as you noticed that this cannot be 
solved with PHP alone.  Please adhere to the topic-oriented structuring of 
Network News, and Usenet in particular.  And please do not start new threads 
for old problems.


PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

[toc] | [prev] | [next] | [standalone]


#5003

FromJeff North <jnorthau@yahoo.com.au>
Date2012-02-26 00:13 +1100
Message-ID<bgnhk7lsn7med6u471map0fqkf3stedqf2@4ax.com>
In reply to#4975
On Fri, 24 Feb 2012 21:59:07 +0800, in comp.lang.php "sl@exabyte"
<sb5309@hotmail.com>
<ji853f$ooi$1@news.albasani.net> wrote:

>| Hi folks.
>| 
>| I thought I have gathered all pieces I need, then suddenly I realise there 
>| is still one problem.
>| 
>| I am implementing chat on the web, ie on a browse. On browser, I can only 
>| use javascript. So the problem is what method to use to listen for incoming 
>| data.
>| 
>| Ajax ? I am just wondering; Ajax does not seem to bother about port, I mean 
>| the standard method is "open socket at server, port 8888...".
>| 
>| Of course, when data is sent to a php file on server, it must be port 80.
>| 
>| Is this the only way on a browser ?
>| 
>| Thanks.
>| 

I don't know if this is what you are wanting but have you had a look
at node.js at http://nodejs.org/

[toc] | [prev] | [next] | [standalone]


#5009

FromArno Welzel <usenet@arnowelzel.de>
Date2012-02-26 04:54 +0100
Message-ID<4F49AD0C.80007@arnowelzel.de>
In reply to#4975
sl@exabyte, 2012-02-24 14:59:

> Hi folks.
> 
> I thought I have gathered all pieces I need, then suddenly I realise there 
> is still one problem.
> 
> I am implementing chat on the web, ie on a browse. On browser, I can only 
> use javascript. So the problem is what method to use to listen for incoming 
> data.

There is no method. You have to poll every x seconds to check, if there
is new information available. Netscape and Mozilla implemented an
alternative way, but this is neither standard nor recommended to be used.

> Ajax ? I am just wondering; Ajax does not seem to bother about port, I mean 
> the standard method is "open socket at server, port 8888...".

Did you try <https://blueimp.net/ajax/>?

> Of course, when data is sent to a php file on server, it must be port 80.

Only, if the server is configured to respond on port 80. A web server
can also use other ports.


-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.php


csiph-web