I am using WildFly with javax.websocket.ClientEndpoint and javax.websocket.OnMessage from JavaSE-1.8 on the client side.
The server (built with Annotations) always sends a string with a length of 20000 characters back to the client when a message comes in:
@ServerEndpoint("/websocket") public class MyEndpoint { @OnMessage public String onMessage(String message, Session session) { session.getBasicRemote().sendText( "eg String with length 20000 .... ... ..." ); } }
Now, when the client sends a request it should receive this response from the server via my processMessage() function.
@ClientEndpoint public class Receiver { @OnMessage public void processMessage(String message, Session session) { System.out.println("Message received: " + message ); } }
This works well for strings shorter than ~500 characters.
Longer strings simply disappear without raising any error - no exception is raised on the client nor the server.
I have set MaxTextMessageBufferSize without any effect.
session.setMaxTextMessageBufferSize(25000);
During testing this I found that using a Browser as a client works without any issues. Using the alternative implementation from org.java_websocket.client.WebSocketClient also works without issues.
So the problem only shows when using javax.websocket. I still would prefer to use javax.websocket because of it's Session-ID support.
Any idea how to fix this or debug the problem? Since nothing is received on the client side I have no idea where to start debugging this.
Thanks,
Jacob