You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ryan Slominski edited this page Oct 16, 2017
·
9 revisions
Java Web Socket Specification (JSR 356) "Irregularities"
Accessing request metadata such as determining the client IP address or request headers (User Agent, X-Forwarded-For, etc.) in a web socket server end point is not well defined by the spec and is generally Application Server (Tomcat vs GlassFish vs Wildfly, etc.) dependent. A complex ThreadLocal approach can be used to avoid proprietary approaches: https://github.com/javaee/websocket-spec/issues/235.
Writes (both Synchronous and Asynchronous) are not required to be thread safe per specification. Most implementations are though as it makes sense that it would be. Tomcat is a notable exception: https://bz.apache.org/bugzilla/show_bug.cgi?id=56026. In Tomcat all writes must be externally synchronized on the session if multiple threads are writing.
The server side API does not handle ping/pong automatically and simply exposes a method for manually sending a ping and listening for a pong. This means you must create your own timer thread: https://github.com/javaee/websocket-spec/issues/176