All,

I'm finally dipping my toes into Websocket-based communication with my Tomcat-based applications. Is it possible to do everything with "real" code and not any annotations?

I was looking for something like the Servlet Async model where you take an existing request and put it into async mode:

        final AsyncContext ac = request.startAsync(request, response);

        ac.start(new Runnable() {

            @Override
            public void run() {
                // Do some stuff

                // Write the response
                ac.complete();
            }
        });

All the tutorials I see use annotations to set up the Websocket endpoint, etc.

Is it possible and/or recommended to use pure-code registration of such endpoints and/or post-HTTP-request upgrade?

I'm wanting to do things like verify that the request belongs to an authenticated user with certain privileges, etc. and only then allow that user to connect using Websocket to trade data across the wire.

How can I relate a Websocket session to an authenticated user? Can I communicate back and forth between the Websocket world and the HTTP-based world like websocket.session <-> HttpSession?

If I want to send a fire-and-forget message to the client from the server, can I just:

session.getAsyncRemote().sendText("hello world");

and ignore the Future<?> object returned, or will I need to verify that message was sent before attempting to send another one?

Thanks,
-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to