can someone help me in PHP?

9 views
Skip to first unread message

vvkch...@gmail.com

unread,
Nov 15, 2007, 3:16:53 PM11/15/07
to Orbited Discussion
I want to develop something similar to LiveHelp on Orbited website.
Can someone guide me how can I go ahead and implement in PHP?

I tried phpchat but dint have enough luck.

Thanks in advance.

Michael Carter

unread,
Nov 16, 2007, 4:50:57 AM11/16/07
to orbite...@googlegroups.com
On Nov 15, 2007 12:16 PM, vvkch...@gmail.com <vvkch...@gmail.com> wrote:

 

I tried phpchat but dint have enough luck.
 
What went wrong? Did you get any error messages?

vvkch...@gmail.com

unread,
Nov 16, 2007, 10:03:09 AM11/16/07
to Orbited Discussion
The orbited is running on port 8000, I can see it from about page.

The users.txt is getting updated with the users. I just cannot send
any messages. Messages are being sent even if i hit send.
How to debug it?

Thanks,
Chandra

On Nov 16, 2:50 pm, "Michael Carter" <cartermich...@gmail.com> wrote:

Michael Carter

unread,
Nov 16, 2007, 12:46:14 PM11/16/07
to orbite...@googlegroups.com
 
The orbited is running on port 8000, I can see it from about page.

The users.txt is getting updated with the users. I just cannot send
any messages. Messages are being sent even if i hit send.
How to debug it?
 
Make sure that you are accessing the page in your web browser on port 8000, otherwise you'll get a cross-domain error. So go to http://127.0.0.1:8000/chat.php to make sure that all requests are being proxied through orbited.

If that doesn't help, then try pasting a javascript error log (from firebug) and the orbited log.

vvkch...@gmail.com

unread,
Nov 17, 2007, 2:08:03 AM11/17/07
to Orbited Discussion
Thanks Michael,
http://127.0.0.1:8000/chat.php is not loading and its showing loading
forever. I think I am missing something somewhere.

I have placed the phpchat files in web root of apache. where should I
place these files?

Do we need Apache to run Orbited? sorry if I sound too stupid!! but I
am very new to comet and orbited :)

Thanks,
Chandra

On Nov 16, 10:46 pm, "Michael Carter" <cartermich...@gmail.com> wrote:
> > The orbited is running on port 8000, I can see it from about page.
>
> > The users.txt is getting updated with the users. I just cannot send
> > any messages. Messages are being sent even if i hit send.
> > How to debug it?
>
> Make sure that you are accessing the page in your web browser on port 8000,
> otherwise you'll get a cross-domain error. So go tohttp://127.0.0.1:8000/chat.phpto make sure that all requests are being

Michael Carter

unread,
Nov 17, 2007, 2:28:03 AM11/17/07
to orbite...@googlegroups.com
On Nov 16, 2007 11:08 PM, vvkch...@gmail.com <vvkch...@gmail.com> wrote:

Thanks Michael,
http://127.0.0.1:8000/chat.php is not loading and its showing loading
forever. I think I am missing something somewhere.

I have placed the phpchat files in web root of apache. where should I
place these files?

You need to make sure that you have turned on the orbited daemon by executing the command orbited in the same directory as the orbited.cfg from the php project. Without the orbited.cfg file, the proxy will not load.

 

Do we need Apache to run Orbited? sorry if I sound too stupid!! but I
am very new to comet and orbited :)

Don't worry, this project isn't as well documented as it should be. You do not need apache to run orbited, but you need apache to run your php scripts. Orbited won't run your php, it will just deliver events to browsers.
 
-Michael Carter

vvkch...@gmail.com

unread,
Nov 17, 2007, 9:16:10 AM11/17/07
to Orbited Discussion
http://127.0.0.1:8000/chat.php - I can only see a blank page !

The following is the log on Orbited command prompt window when I
access orbit.html

2007-11-17 19:40:57,015 ACCESS PROXY /orbit.html -> 127.0.0.1:80
[ 127.0.0.1
]
2007-11-17 19:40:57,030 - Application - CRITICAL - <type
'exceptions.NameError'>
:global name 'ProtocolError' is not defined File "c:\python25\lib
\site-pac
kages\orbited-0.2.0-py2.5.egg\orbited\http\proxy.py", line 244, in
state_pre_bod
y
File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\app.py", l
ine 70, in start
event.dispatch()
File "event.pyx", line 262, in event.dispatch
File "event.pyx", line 116, in event.__simple_callback
File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\http\proxy
.py", line 116, in read_ready
self.buffer.recv(data)
File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\http\proxy
.py", line 183, in recv
return getattr(self, 'state_%s' % self.state)()
File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\http\proxy
.py", line 207, in state_status
return self.state_headers()
File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\http\proxy
.py", line 219, in state_headers
return self.state_pre_body()
File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\http\proxy
.py", line 244, in state_pre_body
raise ProtocolError, "'Transfer-Encoding: chunked' not supported"


Michael, thank you very much for your support.

I hope I can get the chat application running soon... I just cant
wait:)

On Nov 17, 12:28 pm, "Michael Carter" <cartermich...@gmail.com> wrote:
> On Nov 16, 2007 11:08 PM, vvkchan...@gmail.com <vvkchan...@gmail.com> wrote:
>
>
>
> > Thanks Michael,
> >http://127.0.0.1:8000/chat.phpis not loading and its showing loading

Michael Carter

unread,
Nov 17, 2007, 3:13:13 PM11/17/07
to orbite...@googlegroups.com
Okay, I see what the problem is. The Orbited 0.2.0 proxy doesn't support transfer-encoding: chunked, but your webserver is using that. See if you can turn off that option on the server and then all should work.

-Michael Carter

On Nov 17, 2007 6:16 AM, vvkch...@gmail.com <vvkch...@gmail.com> wrote:

http://127.0.0.1:8000/chat.php - I can only see a blank page !

The following is the log on Orbited command prompt window when I
access orbit.html

2007-11-17 19:40:57,015 ACCESS  PROXY   /orbit.html -> 127.0.0.1:80
[ 127.0.0.1
]
2007-11-17 19:40:57,030 - Application - CRITICAL - <type
'exceptions.NameError'>
:global name 'ProtocolError' is not defined       File "c:\python25\lib
\site-pac
kages\orbited-0.2.0-py2.5.egg\orbited\http\proxy.py", line 244, in
state_pre_bod
y
 File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\app.py", l
ine 70, in start
   event.dispatch()
 File "event.pyx", line 262, in event.dispatch
 File " event.pyx", line 116, in event.__simple_callback
 File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
\http\proxy
.py", line 116, in read_ready
   self.buffer.recv(data)
 File "c:\python25\lib\site-packages\orbited- 0.2.0-py2.5.egg\orbited

vvkch...@gmail.com

unread,
Nov 17, 2007, 11:28:50 PM11/17/07
to Orbited Discussion
Thank you Michael,
I have tried for almost an hour to find out how to disable this in
apache server. but dint have luck.
do you know how to do this?

Thanks,
Chandra

On Nov 18, 1:13 am, "Michael Carter" <cartermich...@gmail.com> wrote:
> Okay, I see what the problem is. The Orbited 0.2.0 proxy doesn't support
> transfer-encoding: chunked, but your webserver is using that. See if you can
> turn off that option on the server and then all should work.
>
> -Michael Carter
>
> On Nov 17, 2007 6:16 AM, vvkchan...@gmail.com <vvkchan...@gmail.com> wrote:
>
>
>
> >http://127.0.0.1:8000/chat.php- I can only see a blank page !
>
> > The following is the log on Orbited command prompt window when I
> > access orbit.html
>
> > 2007-11-17 19:40:57,015 ACCESS PROXY /orbit.html -> 127.0.0.1:80
> > [ 127.0.0.1
> > ]
> > 2007-11-17 19:40:57,030 - Application - CRITICAL - <type
> > 'exceptions.NameError'>
> > :global name 'ProtocolError' is not defined File "c:\python25\lib
> > \site-pac
> > kages\orbited-0.2.0-py2.5.egg\orbited\http\proxy.py", line 244, in
> > state_pre_bod
> > y
> > File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
> > \app.py", l
> > ine 70, in start
> > event.dispatch()
> > File "event.pyx", line 262, in event.dispatch
> > File "event.pyx", line 116, in event.__simple_callback
> > File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
> > \http\proxy
> > .py", line 116, in read_ready
> > self.buffer.recv(data)
> > File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
> > \http\proxy
> > .py", line 183, in recv
> > return getattr(self, 'state_%s' % self.state)()
> > File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
> > \http\proxy
> > .py", line 207, in state_status
> > return self.state_headers()
> > File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
> > \http\proxy
> > .py", line 219, in state_headers
> > return self.state_pre_body()
> > File "c:\python25\lib\site-packages\orbited-0.2.0-py2.5.egg\orbited
> > \http\proxy
> > .py", line 244, in state_pre_body
> > raise ProtocolError, "'Transfer-Encoding: chunked' not supported"
>
> > Michael, thank you very much for your support.
>
> > I hope I can get the chat application running soon... I just cant
> > wait:)
>
> > On Nov 17, 12:28 pm, "Michael Carter" <cartermich...@gmail.com> wrote:
> > > On Nov 16, 2007 11:08 PM, vvkchan...@gmail.com <vvkchan...@gmail.com>
> > wrote:
>
> > > > Thanks Michael,
> > > >http://127.0.0.1:8000/chat.phpisnot loading and its showing loading

Michael Carter

unread,
Nov 18, 2007, 4:31:15 AM11/18/07
to orbite...@googlegroups.com
On Nov 17, 2007 8:28 PM, vvkch...@gmail.com <vvkch...@gmail.com> wrote:

Thank you Michael,
I have tried for almost an hour to find out how to disable this in
apache server. but dint have luck.
do you know how to do this?

I looked around as well, and I couldn't find it. I think it may have something to do with which apache modules you have installed. I know other people haven't had this same problem. Try disabling any additional modules that you've added that don't come with apache.  Also, add a line to the php code to manually set the "Transfer-encoding" header to "None" or something like that and see what happens.

Let me know how it goes.

-Michael Carter

Jon Hinson

unread,
Nov 18, 2007, 7:30:50 PM11/18/07
to Orbited Discussion
This may or may not be related, but when I download the phpchat, I
found a couple of errors in the chat.js:

xhr.open("GET", "/chat.php?action=join?user=" + user, true);

from the join function should be:

xhr.open("GET", "/chat.php?action=join&user=" + user, true);

and

xhr.open("GET", "/chat.php?action=msg?id=" + ie_nocache + "&user=" +
name + "&msg=" + msg, true);

from the send_msg function should be:

xhr.open("GET", "/chat.php?action=msg&id=" + ie_nocache + "&user=" +
name + "&msg=" + msg, true);


This got me messed up for a while...something as subtle as changing
a ? to an &.

Hope this helps,
Jon

On Nov 18, 3:31 am, "Michael Carter" <cartermich...@gmail.com> wrote:

Dionysis Zindros

unread,
Nov 19, 2007, 3:07:55 AM11/19/07
to orbite...@googlegroups.com
Regarding Chandra's earlier question on #orbited on IRC...

I found it interesting. They asked whether it is required to open up
multiple connections to the server, one for each channel desired
(where "channel" here is a pub/sub channel, be it a chatroom channel
or anything else). The answer is no, not necessarily; it depends on
your pub/sub framework. You just need to make sure that you publish on
the users accordingly, whether they have one or two connections open,
or one per channel.

This is a topic that requires our attention, as browsers often do not
allow more than 2 HTTP connections open per subdomain...

The way to implement it with one polling connection and multiple
channels is to make the client open up one long-polling connection to
a specific orbited RI (with a specially crafted "request URI" part),
then publish to the same URL for more than one channels (multiple
channels per user), and to different URLs for the same channel
(multiple users per channel).

I'm currently working on a PHP script that will probably allow this,
so check back with me if you need more details about the
implementation.

Or perhaps heyadayo could have an insightful suggestion of why I'm
completely wrong about this approach?

Thanks,
Dionysis.

Michael Carter

unread,
Nov 19, 2007, 6:56:20 AM11/19/07
to orbite...@googlegroups.com
On Nov 19, 2007 12:07 AM, Dionysis Zindros <dion...@gmail.com> wrote:

Regarding Chandra's earlier question on #orbited on IRC...

I found it interesting. They asked whether it is required to open up
multiple connections to the server, one for each channel desired
(where "channel" here is a pub/sub channel, be it a chatroom channel
or anything else). The answer is no, not necessarily; it depends on
your pub/sub framework. You just need to make sure that you publish on
the users accordingly, whether they have one or two connections open,
or one per channel.

This is a topic that requires our attention, as browsers often do not
allow more than 2 HTTP connections open per subdomain...

The way to implement it with one polling connection and multiple
channels is to make the client open up one long-polling connection to
a specific orbited RI (with a specially crafted "request URI" part),
then publish to the same URL for more than one channels (multiple
channels per user), and to different URLs for the same channel
(multiple users per channel).

I'm currently working on a PHP script that will probably allow this,
so check back with me if you need more details about the
implementation.

Or perhaps heyadayo could have an insightful suggestion of why I'm
completely wrong about this approach?

I think you've got it right.

You've two options, distribute by channel or distribute by user. Some applications may have no need for users to be in multiple channels, in which case its best to host a particular channel on a single orbited node. But the more general case is that user's can connect to multiple channels. In this case its imperative that you don't require the user to open multiple connections, and instead you push that work into your pub/sub backend. That means that a particular users belongs to a particular node, and so messages to a particular channel will be sent to every orbited node that contains users in the channel.

I covered this in my presentations at AjaxWorld and AjaxExperience. Check this blog post for the slides and speaking outline: http://www.orbited.org/blog/2007/10/status-of-orbited-and-ajaxexperience/

-Michael Carter

willowdan

unread,
Dec 20, 2007, 3:53:58 AM12/20/07
to Orbited Discussion
Thank you so much, apparently those misplaced "?" are the culprits :)
Reply all
Reply to author
Forward
0 new messages