Correctly shutting down a websocket handler
by Robin Anil
When a client disconnects, I see that onClose is not being fired. The only
way this seems to be firing if client sents a close frame.
Is there any way to detect disconnection and immediately close all the
opened resources.
Robin
Robin Anil | Software Engineer
1 year, 2 months
WebSocket Proxying
by Tobias Verbeke
Hello,
I discovered undertow earlier today and its intro page mentions 'Web Sockets' and 'Reverse Proxy' as features.
According to Google and SO there is currently no Java technology that can do Web Socket proxying.
One such post is the following:
http://stackoverflow.com/questions/22262468/jetty-websocket-proxying
Do you think undertow would be up to the task? Has anyone relevant experience?
Many thanks in advance for any pointer.
Best,
Tobias
8 years, 7 months
We are noticing broken websocket messages
by Robin Anil
Stuart,
We are using undertow websocket library for passing back and forth
serialized JSON messages using Websockets.sendText method
On the client side in Chrome we are noticing that that instead of 1 message
we are receiving 2 where the first one is truncated at some 323,821 B and
the second message is of 148,583 but malformed (its text but its garbled)
and therefore not a JSON even if its concatenated with the first message
We are converting protocol buffers to JSON on the server side and can't
point the finger at that code as it had worked for even bigger JSON
messages.
To investigate this further I need help ruling out any message size or
frame size limitation on undertow that could cause this. Any pointers here
would be helpful.
Robin
8 years, 8 months
Classpath conflict with Tyrus client
by Christian Bauer
Hi
I'm creating and testing websockets in my project and I have the following classpath:
compile "io.undertow:undertow-servlet:$undertowVersion"
compile "io.undertow:undertow-websockets-jsr:$undertowVersion"
testCompile "org.glassfish.tyrus:tyrus-client:$tyrusVersion"
testCompile "org.glassfish.tyrus:tyrus-container-grizzly-client:$tyrusVersion"
This doesn't work:
Caused by: java.lang.ClassCastException: org.glassfish.tyrus.client.ClientManager cannot be cast to io.undertow.websockets.jsr.ServerWebSocketContainer
at io.undertow.websockets.jsr.Bootstrap.handleDeployment(Bootstrap.java:62)
at io.undertow.servlet.core.DeploymentManagerImpl.handleExtensions(DeploymentManagerImpl.java:252)
at io.undertow.servlet.core.DeploymentManagerImpl.deploy(DeploymentManagerImpl.java:152)
The code in Bootstrap.java randomly picks an implementation through ServiceLoader and tries to cast it:
https://github.com/undertow-io/undertow/blob/master/websockets-jsr/src/ma...
Why not load the desired type directly? Should I be able to deploy several websocket implementations? If not, what's the best option for testing?
Thanks,
Christian
8 years, 8 months
how to use ExceptionHandler & security together
by Michael Grove
I have a pretty basic server set up:
ExceptionHandler -> Security Handlers * -> PathTemplateHandler -> my routes
* The security handlers are set up as shown in the examples [1] and I'm
also using the same `IdentityManager` for my tinkering.
What I'm seeing is that in ExceptionHandler [2] the request is just passed
directly onto the next handler, which in this case, is the start of the
security handlers.
The request is passed through each handler until it hits
`AuthenticationCallHandler` and is moved off the IO thread [3]. The call
then returns, and all the invocations to the next handler finish back up
the stack until `ExceptionHandler`, where the call completes successfully.
Trouble is, the request was malformed and the route handling it threw an
exception and it wasn't handled as expected.
I guess the correct answer is that I shouldn't have allowed it to get
thrown out of the handler for the route; catch it there and send the
expected error response.
But, I'm curious if there was a way to do this with the handlers, or
perhaps, more generally, what are the expectations along the call chain of
handlers when some may move off the initial IO thread.
Thanks.
Mike
[1]
https://github.com/undertow-io/undertow/blob/master/examples/src/main/jav...
[2]
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io...
[3]
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io...
8 years, 8 months