Using DWR to detect browser close events

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using DWR to detect browser close events

rmohan
Hi,
            I am looking at reverse ajax techniques to ping my client's browser. As we know detecting crashed or closed browsers seems to be impossible if caches and cookies are restored. I am unaware of any mechanism that banks might use to implement this. Ours is a core banking system.

My current assumption is that DWR can keep track of dropped HTTP connections. So I can use a heartbeat but also use an exception handling mechanism to differentiate between crashed browsers and new browsers. I don't want users of crashed browsers to restored the DWR connections.

Can I try this mechanism with DWR ? This might also help us evaluate reverse ajax and other modern techniques for website design.

Thanks,
Mohan

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit us at http://www.polarisFT.com

Reply | Threaded
Open this post in threaded view
|

Re: Using DWR to detect browser close events

Mike Wilson
Administrator
There is no API for explicitly detecting lost http connections.
I think what comes closest to what you ask for in DWR is listening for ScriptSessions through ScriptSessionListener:
ScriptSessions are destroyed through a timeout mechanism when not hearing from the browser for a while.
 
You could do the same kind of solution based on the HttpSession if you configure the appserver to use a short timeout and then use Ajax heartbeats to keep it alive as long as the user has the site open.
 
Best regards
Mike Wilson
 
 
Mohan wrote:
Hi,
            I am looking at reverse ajax techniques to ping my client's browser. As we know detecting crashed or closed browsers seems to be impossible if caches and cookies are restored. I am unaware of any mechanism that banks might use to implement this. Ours is a core banking system.

My current assumption is that DWR can keep track of dropped HTTP connections. So I can use a heartbeat but also use an exception handling mechanism to differentiate between crashed browsers and new browsers. I don't want users of crashed browsers to restored the DWR connections.

Can I try this mechanism with DWR ? This might also help us evaluate reverse ajax and other modern techniques for website design.

Thanks,
Mohan

This e-Mail may contain proprietary and confidential information and is sent for the intended recipient(s) only. If by an addressing or transmission error this mail has been misdirected to you, you are requested to delete this mail immediately. You are also hereby notified that any use, any form of reproduction, dissemination, copying, disclosure, modification, distribution and/or publication of this e-mail message, contents or its attachment other than by its intended recipient/s is strictly prohibited. Visit us at http://www.polarisFT.com

Reply | Threaded
Open this post in threaded view
|

Re: Using DWR to detect browser close events

radhakrishnan.mohan
In reply to this post by rmohan
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using DWR to detect browser close events

radhakrishnan.mohan
In reply to this post by rmohan
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Using DWR to detect browser close events

Mike Wilson
Administrator
In reply to this post by radhakrishnan.mohan
The main purpose of the retry logic is to try to keep live contact with the
browser without putting too much load on the server. I think you are missing
that this is only a client-side feature. To invalidate user logins I think
you want to work on the server-side and that's where you have the
ScriptSessionListener.

Mohan wrote:

> Hi,
>
> I was wondering why this mechanism cannot be used. Browsers can be
> offline for various reasons but this seems to be a mechanism to
> invalidate a session.
>
> http://directwebremoting.org/dwr/documentation/reverse-ajax/retry.html
>
> Am I missing something here ?
>
> Thanks,
> Mohan

Reply | Threaded
Open this post in threaded view
|

Re: Using DWR to detect browser close events

Mike Wilson
Administrator
In reply to this post by radhakrishnan.mohan
DWR's use of threads is no problem.
If you use certain technologies such as EJB, transactions, etc, there are in
some cases restrictions on how you create threads in your own application
code. You can read up on these subjects in other forums.

Yes, keeping many sockets/connections open simultaneosuly is definitely
interesting for how you dimension your servers.

Mohan wrote:

> Hi,
>
> One other question. I think the thread API is forbidden in managed
> Application server environments.
>
> Reverse pinging of the Browser is implemented using java.lang.Thread
> API. Does that mean there is no guarantee that the polling wil succeed
> ?
>
> I should also think about the scalability of a long-polling socket in
> relation to the number of users.
>
> Hope I am on the right track.
>
> Thanks,
> Mohan