how to make the server aware of ReverseAjax

View: New views
4 Messages — Rating Filter:   Alert me  

how to make the server aware of ReverseAjax

by Nitin Thakur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Seems like i'm messing too much with connection limit problem. But, here goes my query.
In my application, i do "dwr.engine.setActiveReverseAjax(true)" and "dwr.engine.setActiveReverseAjax(false)" time-to-time to reduce the burden of keeping one permanent connection for reverse ajax even if the client does not need it.

I want my server also to be aware of this thing i.e, whether there is a reverse ajax connection with a client or not. Explicitly Calling the server is not a reliable approach. I want some sort of listener at the server end which keeps track of when ActiveReverseAjax has been set true/false.

Otherwise, can somebody suggest my some way to set ActiveReverseAjax true or false from server side only.


Plz somebody help me out.. Hey Joe, are you listening?

Re: how to make the server aware of ReverseAjax

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


(I've been away at JavaOne, and just catching up)
You can do this:

import org.directwebremoting.proxy.dwr.Engine;

Session s = // the script session(s) of the browsers to toggle active reverse ajax
Engine engine = new Engine(s);
s.setActiveReverseAjax(true);

Joe.



On Thu, May 8, 2008 at 10:34 AM, Nitin Thakur <myegotrip@...> wrote:

Seems like i'm messing too much with connection limit problem. But, here goes
my query.
In my application, i do "dwr.engine.setActiveReverseAjax(true)" and
"dwr.engine.setActiveReverseAjax(false)" time-to-time to reduce the burden
of keeping one permanent connection for reverse ajax even if the client does
not need it.

I want my server also to be aware of this thing i.e, whether there is a
reverse ajax connection with a client or not. Explicitly Calling the server
is not a reliable approach. I want some sort of listener at the server end
which keeps track of when ActiveReverseAjax has been set true/false.

Otherwise, can somebody suggest my some way to set ActiveReverseAjax true or
false from server side only.


Plz somebody help me out.. Hey Joe, are you listening?
--
View this message in context: http://www.nabble.com/how-to-make-the-server-aware-of-ReverseAjax-tp17123768p17123768.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...



Re: how to make the server aware of ReverseAjax

by Nitin Thakur :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think the code you have suggested should actually be like this:

import org.directwebremoting.proxy.dwr.Engine;

ScriptSession s = // the script session of the browser to toggle active reverse ajax
or
Collection<ScriptSession> s= // the script session(s) of the browsers to toggle active reverse ajax

Engine engine = new Engine(s);
engine.setActiveReverseAjax(true);

Please correct me if i am wrong.

Because, i am trying this but it is not working; it is not making any connection with the client whose ScriptSession i pass to the Engine Constructor. Note that when i say engine.setActiveReverseAjax(true), the reverse ajax with the client has been set false.
I am getting the ScriptSessions from a collection that i maintain at server side. This map is updated when a user logins or refreshes his page.

Re: how to make the server aware of ReverseAjax

by Joe Walker-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Yes - it was a typo. engine.setActive...
Clearly this can't asynchronously turn active reverse ajax on. There's nothing we can do that will achieve that.
If run asynchronously, what the above will do however is to turn active reverse ajax on when the browser next contacts the server.

If you do those lines as part of a remote call from a client then it ought to work correctly. because the 2 are already in contact and dwr as a method of passing messages to the browser

Joe.

On Wed, May 28, 2008 at 8:11 AM, Nitin Thakur <myegotrip@...> wrote:

I think the code you have suggested should actually be like this:

import org.directwebremoting.proxy.dwr.Engine;

ScriptSession s = // the script session of the browser to toggle active
reverse ajax
or
Collection<ScriptSession> s= // the script session(s) of the browsers to
toggle active reverse ajax

Engine engine = new Engine(s);
engine.setActiveReverseAjax(true);

Please correct me if i am wrong.

Because, i am trying this but it is not working; it is not making any
connection with the client whose ScriptSession i pass to the Engine
Constructor. Note that when i say engine.setActiveReverseAjax(true), the
reverse ajax with the client has been set false.
I am getting the ScriptSessions from a collection that i maintain at server
side. This map is updated when a user logins or refreshes his page.
--
View this message in context: http://www.nabble.com/how-to-make-the-server-aware-of-ReverseAjax-tp17123768p17506467.html
Sent from the DWR - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...