users@grizzly.java.net

Re: websocket question #2

From: Ryan Lubke <ryan.lubke_at_oracle.com>
Date: Thu, 02 Feb 2012 09:40:40 -0800

On 2/2/12 8:38 AM, rama.rama_at_tiscali.it wrote:
> Hi there,
>
>
> i have take a moment to review web socket class and i have
> some more question :)
>
>
> the biggest issue that i am facing is how to
> associate a socket to a certain user
>
> for istacence i have to detect
> who (user) is sending this message.
> public void onMessage(com.sun.
> grizzly.websockets.WebSocket socket, java.lang.String text) {
>
> }
>
> what
> can be possible is to add into an hash map something like Map<WebSocket,
> User>
>
> but, on this method
> public boolean isApplicationRequest
> (Request request) {
> return true;
> }
>
> where i can found the
> user (using cookies) i don't know how to get the web socket (probably
> because the
> websocket isn't connected yet)
>
>
>
> so, to make it easy
> 1.
> is possible to get the web socket on isApplicationRequest method? (imho
> no, web socket isn't yet created)
No, this check is performed to prevent dispatching to the WS runtime
unless necessary.
> 2. is possible to get the header of
> the request that create a web socket on "onMessage" method?
> in that way
> i can always re-fetch the user in a very easy way
At the moment, there isn't a way to do this. However, if you could log
an issue [1], we can address
this asap.

[1] http://java.net/jira/browse/GRIZZLY
>
>
> warm regards!
>
>
>
> E' nata indoona: chiama, videochiama e messaggia Gratis. Scarica indoona per iPhone, Android e PC: http://www.indoona.com/