Not that I know of.
The usual HTTP errors for this condition are 502 or 504, you may want
to return that code embedded in a comet response to the client.
Simon
--
http://bordet.blogspot.com
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
On Thu, Jun 25, 2009 at 05:35, neek<neekf...@gmail.com> wrote:
>
> I use the dojo 1.3.1 client implementation in dojox.cometd, and it
> seems pretty straightforward. I see that in the dojox client
> implementation, longPollTransportJsonEncoded.js's sendMessage()
> function uses the rawXhrPost's error callback to call
> cometd._publishMeta, which causes the cometd code to publish to the
> dojo channel with:
>
> dojo.publish(this.prefix + "/meta", [meta]);
>
> The meta information includes an action="publish" and
> successful=false.
>
> Thus, if you have connection.subscribed()'d to a channel called "/
> foo", and try to post a message which fails because the remote server
> is down, you can dojo.subscribe("/foo/meta") and get a notification of
> the fact.
>
> Similarly, the longPollTransportJsonEncoded method openTunnelWith()
> sets up an error handler on the connection which will publish on the
> dojo channel "/foo/meta" with an action="connect" and
> successful=false. This seems to be the hook for notifications of when
> a service becomes unavailable.
>
> Does that help?
Just bear in mind that that way of doing things will be different when
dojo merges in the latest cometd code.
Greg's working on a compatibility layer, but not sure what extent it will have.
If you start an app from scratch, it's better to start with the new code.
Cheers,
On Thu, Jun 25, 2009 at 20:11, j<jac...@gmail.com> wrote:
>
> Hi Simone,
>
> The new cometd is different from old cometd in what ways? Can you
> share some insights?
>
> Yes I am starting an app from scratch.
The basic API is quite similar, if not identical.
Changes are in:
1. extension registration, now a full blown API with callbacks from
comet to extension,
2. in the initialization, now split in 2 methods to allow reconfiguration,
3. in the meta channels and how meta messages are delivered, now not
anymore based on toolkit event system (to achieve portability) and
with a global channel for failures
4. some facility like reestablish is gone (not sure about this)
5. enhanced logging
6. better configuration for reconnections
7. better handling of the 2 connection limit, also configurable,
8. cleaner code and code documentation.
What's missing is the cometd.org documentation, but I am working on
it, with examples, gotchas, etc.
I don't mind native english speaker review, or even better documentation help.
Cheers,
Simon
--
On Thu, Aug 6, 2009 at 09:43, neek<neekf...@gmail.com> wrote:
>
> On Aug 6, 2:08 pm, Jan Bartel <j...@mortbay.com> wrote:
>> You need to use dojox.cometd.addListener() for the meta channels,
>> not dojox.cometd.subscribe().
>
> Thanks for the response. I get very similar behaviour with addListener
> ("/meta/*" ....), and still find no disconnect event is fired.
>
> The beta10 source in org/cometd/cometd.js seems to show subscribe()
> simply calling _addListener(), with a little extra housekeeping to do
> with publishing a /meta/subscribe message about the new subscription.
> I appreciate the effort made in the docs to theologically separate
> subscribe() and addListener(), but am not sure there's much difference
> in their implementation.
I am not sure what you mean here.
There is a big difference in that if you don't call subscribe(), any
server-side event you're interested to will not be delivered to you,
no matter if you called addListener().
> From my debugging of the longPollTransport stuff (the tunnelCollapse()
> method never seems to be fired for me) I'm driving toward the
> conclusion that there is no long standing network connection made by
> the new cometd code that would be broken by Jetty shutting down.
If you are looking at tunnelCollapse() then you're looking at a very
old version of Cometd; you should look at the new implementation,
which you seem to have looked to when you were talking about
subscribe.
> I'm unfamiliar with the latest Firebug gui, but cannot see any open
> connections after my test webpage has initialised its cometd
> connection. Thus, no error callback is fired when I shut down Jetty,
> so no attempt is made by cometd to notify my app, either as a
> subscriber or listener, about the drop in connection. This is also
> why getStatus() always returned "connected".
Are you doing cross-domain communication ?
If that's the case, then logging and notification of failures are much
reduced due to the way the transport implements the cross-domain
communication.
> Just to be clear, all my debugging shows that my test app handshakes,
> connects, gets /meta/* events, and publishes/receives messages on my
> channel just fine. However, when I shut down Jetty, absolutely no
> further events happen on the client. The last thing I see is usually
> a "chat received!" message indicating the last publish/subscribe event
> worked.
>
>> This is explained in the doco here:http://cometdproject.dojotoolkit.org/documentation/cometd-javascript/...
>
> Thank you. I had wandered into http://cometd.org and found some of
> that documentation, but since I had working subscriptions to the meta
> channels and debugged the code a fair bit, I had a feeling I was
> beyond the documentations ability to guide me.
>
>> The doco also shows you how to listen on /meta/connect to find out
>> the connection status.
>
> I presume that if getStatus() returns "connected" even when the remote
> server has shut down (and I've waited some 5 minutes or more to allow
> a network timeout to happen) there must be some more serious
> underlying fault that would trip up even the /meta/connect system.
This could happen with cross-domain transport. We have to improve
failure notification for that.
On Tue, Aug 11, 2009 at 04:56, neek<neekf...@gmail.com> wrote:
>> Are you doing cross-domain communication ?
>
> I'm doing everything on localhost, so no cross-domain that I know of.
Well not exactly.
If you load the JS files from "localhost" but then specify the URL of
the Bayeux server as "127.0.0.1", then that's treated as cross-domain.
As for your troubles setting up a project, there is a primer you can
follow here: http://cometdproject.dojotoolkit.org/documentation/primer
The primer explains (or should do that ;) how to setup a basic
skeleton for your project.
I'd appreciate feedback, as I may have overlooked some important parts.
If you use Maven, it is as simple as (after building cometd):
$ mvn archetype:generate -DarchetypeCatalog=local
and then follow the instructions.
This will correctly create a war structure that contains the correct
files for both dojo, jquery, jetty6, jetty7 and any combination
thereof.
Let us know how goes with the primer.
On Tue, Aug 11, 2009 at 15:38, neek<neekf...@gmail.com> wrote:
> I was coming from Glassfish, and the live code replacement features
> available in its server adapter make developing a dynamic web
> application a breeze. In comparison, I'm now stuck with Jetty 7, with
> no server adapter, a manually created build.xml to build my .war file,
> and a jetty context xml file for hot deployment that still seems to
> need me to stop and restart jetty when I change my javascript files.
> Development is much (much much) more annoying than with Glassfish.
Well, Jetty supports a development mode using the Maven plugin.
I read you're not a Maven fan, but nowadays IDEs supports well Maven.
> But today .. joy of joys .. success!
Good you finally made it.
>> The primer explains (or should do that ;) how to setup a basic
>> skeleton for your project.
>> I'd appreciate feedback, as I may have overlooked some important parts.
>
> Everyone's different. My response to your primer is:
>
> - I do not want to use Maven at all.
Fine.
> Figuring out deployment from the
> 36 pom.xml files included in the beta10 drop, when you've never used
> Maven before, is no fun. I understand that you're using Maven as your
> build tool, but please don't tie an understanding of the .war
> directory structure to an understanding of the build tool. Rather,
> explain the required directory structure (e.g. how to replace the
> dojox/* and org/* .js files), and then perhaps explain how that is
> achieved using your favourite tool.
I think this is explained in the "non maven way" section, but from
your comment I don't understand if that section does not explain well
enough.
Can you be more precise on what can be improved in the "non maven way" section ?
> - I would like to run in Glassfish, but had no luck at all getting it
> to work (I think I posted here about the ContinuationFilter not
> appearing to work).
Sorry have no experience using GF, so I cannot help here.
> - If it is really impossible to run beta10 (or whatever version) in
> Jetty 6, please make that clear.
Mmm, it's not, unless I miss something obvious.
> I found the Jetty docs quite
> frustrating, often talking about only Jetty 6 (because 7 is so new,
> apparently), and many might try 6 by default, as I did. It's a long
> and painful road to a dead end.
Can you pinpoint where that is ? I'll try to be clearer.
> - It might be worth mentioning which parts of the web.xml need
> replacing (under your "The Non-Maven Way" heading). I believe only
> the 'cometd' servlet needs configuring, with the optional
> ContinuationFilter for non-Jetty containers.
Ok, we need a section for non Jetty servlet containers.
We're open to contribution though :)
> As a side note, the
> web.xml has nothing to do with Maven.
Of course.
>> If you use Maven, it is as simple as (after building cometd):
>
> Again.. I have an existing project that does not use Maven. Being
> told to run a one-liner Maven command is extremely frustrating, and
> causes me to completely ignore it and try to do everything by hand
> with no instructions.
Ok, but is not the "non maven way" enough ?
It explains what to do to get the correct war structure, and from
there use the tool you want: Ant, IDE, whatever.
Maybe I am missing something ?
>> Let us know how goes with the primer.
>
> It looks very useful. Is it linked to from cometd.org? I didn't find
> it.
It's the first link of the "Books" section on the left of the
Documentation page: http://cometdproject.dojotoolkit.org/documentation
Cheers,
So I hear your frustration that your "existing project that
does not use Maven" and that you "look forward to getting my
full app's functionality restored".
I'd like to remind you that we are not yet released a 1.0 and
are still finishing a significant refactor to separate cometd.org
out from jetty and to make it portable across servlet-3.0
webcontainers - while servlet-3.0 is also still not finalized
and a moving target.
If you want stability, the version bundled with the stable
jetty-6 releases is stable.
You are on the bleeding edge when using the latest version
and some breakages are to be expected.
So sorry for disruptions, breakages and documentation that is
not up to date. I do believe things are stabilizing and the
documentation is already much improved.
cheers