You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by aoisagi <ao...@gmail.com> on 2013/01/05 03:54:33 UTC

Camel websocket disconnect trigger

Hi, I just started playing around with camel-websocket, however, there
doesn't seem to be a trigger when the client quit the browser. Is there some
kind of mechanism to detect disconnected socket so I can recycle some
resources that's dedicated to that socket previously? Thanks.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-websocket-disconnect-trigger-tp5724934.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel websocket disconnect trigger

Posted by kanu_t <ka...@cypatterns.com>.
Hi,
I am new to Camel Websocket support, however, I too have this need to know
if a client has disconnected from the server. This is necessary to clean up
any session related data we might store for each client. For example which
data feed a client is interested in. Otherwise, we have to implement a
heartbeat mechanism to know if a client is really connected, which can be
non trivial and resource intensive. We should be able to specify a listener
class, may be as optional query parameter for end point, for session events
like new connection created, disconnected etc, which should get the
connectionkey as part of the event.

Is there a way to know the disconnection already that I could not figure
out?
Thanks a lot.



--
View this message in context: http://camel.465427.n5.nabble.com/Camel-websocket-disconnect-trigger-tp5724934p5772572.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Camel websocket disconnect trigger

Posted by Claus Ibsen <cl...@gmail.com>.
On Sat, Jan 5, 2013 at 7:56 AM, Willem jiang <wi...@gmail.com> wrote:
> Hi,
>
> Current Camel websocket manage the web socket connection itself with the MemoryWebsocketStore. I'm not sure what kind of resource you need to manage yourself.
>
> You should be able to know if the client web socket disconnect if you can pass the customer NodeSynchronization into the WebSocketEndpoint. As current Camel WebSocket doesn't expose the API, you need to hack the code to pass the reference.
>

So is the idea that if the client disconnect (somehow) then the Camel
route should trigger a message, so you can deal with client being
disconnected?
Or is this not the case, to have disconnects being triggered in the routes?

from websocket:foo
  choice
    if disconnect
      to log client is disconnected
    otherwise
      to bean foo


>
> --
> Willem Jiang
>
> Red Hat, Inc.
> FuseSource is now part of Red Hat
> Web: http://www.fusesource.com | http://www.redhat.com
> Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
>           http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
> Twitter: willemjiang
> Weibo: 姜宁willem
>
>
>
>
> On Saturday, January 5, 2013 at 10:54 AM, aoisagi wrote:
>
>> Hi, I just started playing around with camel-websocket, however, there
>> doesn't seem to be a trigger when the client quit the browser. Is there some
>> kind of mechanism to detect disconnected socket so I can recycle some
>> resources that's dedicated to that socket previously? Thanks.
>>
>>
>>
>> --
>> View this message in context: http://camel.465427.n5.nabble.com/Camel-websocket-disconnect-trigger-tp5724934.html
>> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
>
>
>



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
FuseSource is now part of Red Hat
Email: cibsen@redhat.com
Web: http://fusesource.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Re: Camel websocket disconnect trigger

Posted by Willem jiang <wi...@gmail.com>.
Hi,

Current Camel websocket manage the web socket connection itself with the MemoryWebsocketStore. I'm not sure what kind of resource you need to manage yourself.

You should be able to know if the client web socket disconnect if you can pass the customer NodeSynchronization into the WebSocketEndpoint. As current Camel WebSocket doesn't expose the API, you need to hack the code to pass the reference.


--  
Willem Jiang

Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://www.fusesource.com | http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem




On Saturday, January 5, 2013 at 10:54 AM, aoisagi wrote:

> Hi, I just started playing around with camel-websocket, however, there
> doesn't seem to be a trigger when the client quit the browser. Is there some
> kind of mechanism to detect disconnected socket so I can recycle some
> resources that's dedicated to that socket previously? Thanks.
>  
>  
>  
> --
> View this message in context: http://camel.465427.n5.nabble.com/Camel-websocket-disconnect-trigger-tp5724934.html
> Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).