tyrus

Javax Websocket closing due to Illegal UTF-8 Sequence

百般思念 提交于 2019-12-12 12:57:18
问题 I'm writing a Websocket client in Java, using javax.websocket API, and org.glassfish.tyrus as the implementation. Everything usually works, but sometimes, when I'm receiving very large strings, the connection closes with a mysterious 'Illegal UTF-8 Sequence' as the close reason. log.info("Ws closed cuz: " + reason.getCloseCode() + " , " + reason.getReasonPhrase() + " , " + reason.toString()); Output: INFO: Ws closed cuz: NOT_CONSISTENT , Illegal UTF-8 Sequence , CloseReason[1007,Illegal UTF-8

Spring Websocket Server Resets Connection When Sending Large Amounts of Data

∥☆過路亽.° 提交于 2019-12-11 07:08:46
问题 I'm having issues where while trying to send data from a Spring Websocket Server (hosted on Tomcat) it seems to reset the connection in the middle of trying to send the message. The error seems happen more when sending large amounts of binary data (5526584 bytes in the example here), but I've seen it happen on the text channel and with less data as well. However sending more then 5 or so MB seems to crash it relatively consistently. Edit - The below the end edit block is the server side code

How can I programmatically enable WSS for a Tyrus WebSocket @ServerEndpoint

巧了我就是萌 提交于 2019-12-11 02:54:28
问题 I have a microservice that has a REST endpoint and a WebSocket endpoint. It Spring-wires Grizzly and Tyrus, and adds in authentication via SSO using a JAX-RS filter and a ServerEndpointConfig.Configurator. I've added in SSL to the REST endpoint using SSLContextConfigurator and SSLEngineConfigurator and a (currently) self-signed certificate. I don't see a way to do the same for org.glassfish.tyrus.server.Server in Tyrus 1.14. In fact, the code hardwires the protocol name, which makes me wonder

How to deploy Tyrus (JSR 356 implementation) to a web container?

牧云@^-^@ 提交于 2019-12-10 17:53:32
问题 I am attempting to deploy Tyrus to a Tomcat 8 container and am failing. According to the documentation, I should be able to deploy a WAR containing my classes and supporting Tyrus classes/dependencies and all classes annotated with @ServerEndpoint should be found in the WAR and deployed as websocket end points. This instruction threw me a little because I'm not defining any sort of filter in the deployment descriptor but decided that I must be somehow depending on some unknown magic in the

Access UserAgent in Websocket session?

点点圈 提交于 2019-12-10 10:15:11
问题 Using the Tyrus reference implementation of Java's "JSR 356 - Java API for WebSocket", I cannot find a way to access the HTTP connection that was used for the Websocket upgrades. Thus, I cannot access the HTTP headers that the browser sent. Is there a way to read the HTTP UserAgent header? Casting a "Session" object to "TyrusSession" or similar would be acceptable, I have to do it to get the Remote Address anyway. Sending the UserAgent again as a message inside the Websocket connection would

Setting websocket SSL on grizzly

爷,独闯天下 提交于 2019-12-08 09:46:01
问题 I'm trying to configure a WebSocket over SSL with the "javax.websocket.server.ServerEndpoint" on a grizzly container. However i can't find any way to set the SSL property to my endpoint. My endpoint code : import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; @ServerEndpoint( Value="/ptiWs", decoders = {ApiMessage.ApiCoder.class}, ) public class WebsocketEndpoint { private static final Logger LOG =

Tyrus WebSockets (Java) - how to set client local ip address

此生再无相见时 提交于 2019-12-06 19:34:40
问题 Is there a way to specify the local ip-address and port when using WebSockets (Tyrus)? I'm looking for the same thing you can do with the full 4 parameters constructor of Socket EDIT : I have found that the low level Grizzly TCPNIOTransport does have a connect() method with local-address, but I don't know how to make a Tyrus Client use it. 回答1: The GrizzlyClientSocket never calls the transport connect() method with the local-address parameters. You'll need to ask a feature request from Tyrus

Access UserAgent in Websocket session?

荒凉一梦 提交于 2019-12-06 05:18:45
Using the Tyrus reference implementation of Java's "JSR 356 - Java API for WebSocket", I cannot find a way to access the HTTP connection that was used for the Websocket upgrades. Thus, I cannot access the HTTP headers that the browser sent. Is there a way to read the HTTP UserAgent header? Casting a "Session" object to "TyrusSession" or similar would be acceptable, I have to do it to get the Remote Address anyway. Sending the UserAgent again as a message inside the Websocket connection would be my fallback solution. WARNING: ServerEndpointConfig is shared among all endpoint instances and

Receiving pings with Java EE Websocket API

风格不统一 提交于 2019-12-06 04:56:40
问题 I'm currently working with the Tyrus reference implementation of the Java Websocket API. I've successfully created a server endpoint that receives binary messages, text messages, and pong messages, but I'm stuck trying to get it to receive ping messages. I've searched through much of the Tyrus source code and read the Jave EE Websocket tutorial but neither demonstrate functionality for receiving pings (only for sending them). Does anyone know if this is something not possible with the current

Tyrus WebSockets (Java) - how to set client local ip address

徘徊边缘 提交于 2019-12-04 23:38:42
Is there a way to specify the local ip-address and port when using WebSockets (Tyrus)? I'm looking for the same thing you can do with the full 4 parameters constructor of Socket EDIT : I have found that the low level Grizzly TCPNIOTransport does have a connect() method with local-address , but I don't know how to make a Tyrus Client use it. The GrizzlyClientSocket never calls the transport connect() method with the local-address parameters. You'll need to ask a feature request from Tyrus project, or write your own implementation of GrizzlyClientSocket, which you'll need to call from your own