Questions tagged [jsr356]

JSR 356, Java API for WebSocket, specifies the API that Java developers can use when they want to integrate WebSockets into their applications—both on the server side as well as on the Java client side. Every implementation of the WebSocket protocol that claims to be compliant with JSR 356 must implement this API.

JSR 356 defines a standard API for creating WebSocket applications (as standardize by IETF in protocol RFC 6455) enabling Web clients or native clients leveraging any WebSocket implementation to easily communicate with a Java back end.

JSR 356 provide support in the Java EE platform for:

  • Creating WebSocket Java components to handle bi-directional WebSocket conversations
  • Initiating and intercepting WebSocket events
  • Creation and consumption of WebSocket text and binary messages
  • The abililty to define WebSocket protocols and content models for an application
  • Configuration and management of WebSocket sessions, like timeouts, retries, cookies, connection pooling
  • Specification of how WebSocket application will work within the Java EE security model

See:

52 questions
1
vote
1 answer

Java websocket connection check if same user reconnects

In my application I have a sessionhandler that stores all connected sessions when they connect and removes them if they disconnects properly. If they do not I keep the sessions and if they reconnect I replace the old session with the new one. (The…
Runar Halse
  • 3,528
  • 10
  • 39
  • 59
1
vote
1 answer

How to redirect messages from one endpoint to another using java websockets (jsr 356)

I am doing a personal project to learn about java websockets. Basically my HTML clients sends messages to my server through JSR 356 websockets. The endpoint @ServerEndpoint("/wsServer") receives all messages from the clients and I would like to see…
masber
  • 2,875
  • 7
  • 29
  • 49
1
vote
1 answer

Why does Jetty JSR356 behave differently with regards to checkOrigin and modifyHandshake

I was playing around with Jetty (9.2.3v20140905) by connecting a web socket endpoint where I tried to use my own ServerEndpointConfig when I came across Jetty's code to see how it was used. I notice that it is used in JsrCreator when a web socket…
Paul
  • 673
  • 9
  • 19
1
vote
1 answer

Exception occur when refresh page in Tomcat JSR 356 websocket

I have ServerEndpoint class: @ServerEndpoint(value = "/websocket", configurator = ServletAwareConfig.class) public class WebsocketEndpoint { @OnOpen public void onOpen(Session session) { System.out.println("OnOpen"); } …
Amigo
  • 179
  • 4
  • 10
1
vote
1 answer

How to pass parameter/attribute to JSR-356 WebSocket client (@ClientEndpoint)?

I want to add some additional attributes to container-instantiated WebSocket client endpoint for grouping/statistics. I created a client WebSocket endpoint with JSR-356: Session session = container.connectToServer( MyClientEndpoint.class , uri ); I…
Piotr Müller
  • 5,323
  • 5
  • 55
  • 82
1
vote
1 answer

Java WebSocket API: Restrict service to certain domains

As mentioned e.g. in the HTML5Rocks WebSockets tutorial, The server decides whether to make its service available to all clients or only those that reside on a set of well defined domains. Ok, how to do that with the Java API for WebSocket 1.0…
Chris Lercher
  • 37,264
  • 20
  • 99
  • 131
0
votes
0 answers

No 'javax.websocket.server.ServerContainer' ServletContext attribute with Spring boot and Undertow

I am using Spring boot and Undertow for my websockets server and it seems it doesn't properly implement the servlet specification because I'm getting following error when upgrading the request to WS: 2022-09-20 09:53:11,349 ERROR…
0
votes
1 answer

JSR-356 websocket - cannot get return code after stopping container

I have built a client server application using javax websockets.Though JSR 356 doesn't have methods to stop websocket container, i managed to stop the container after casting to jetty Lifecyle.Once stopping the container i have…
0
votes
1 answer

javax.websocketclient : how to send large binary data from clientendpoint to serverendpoint

I'm trying to build a server client application using jetty. I have setup a jetty server and configured websockets. Sending text messages works fine between client and server. But how binary data as inputstream could be sent from client endpoint. I…
0
votes
1 answer

JSR-356 javax websockets in Jetty (embedded and not)

Given that: I'd like to deploy webapp, packaged as WAR having web.xml in it, to Jetty server. Within that app, I'd like to be able to have a JSR-356 specified javax websocket endpoints configured. I prefer, that those endpoints to be provided via…
GullerYA
  • 1,320
  • 14
  • 27
0
votes
1 answer

NoSuchMethodError using dropwizard websocket jee7 bundle server

I'm using Dropwizard for a REST server and dropwizard-websocket-jee7-bundle to enable websockets. For the websocket server I used this example. Testing the websocket server standalone works fine, but in combination with Dropwizard, when a client…
wmw301
  • 49
  • 1
  • 8
0
votes
1 answer

Register ServletRequestListener from OSGi Bundle

I have a JSR-356 (WebSocket API) code that is packaged in an OSGi bundle. The servlet loads the code via Apache Felix if needed. I want to register a ServletRequestListener, which I would normally put in the web descriptor:
isapir
  • 21,295
  • 13
  • 115
  • 116
0
votes
0 answers

Websockets on Atmosphere.js keep closing , possible bringing the server down

We have a GWT application deployed on AWS ELB. We're using an Atmosphere.js and websocket set up to get number of live users every second to the UI. I keep seeing this error on the UI: Websocket closed, reason: Connection was closed abnormally…
0
votes
1 answer

WebSocket Handshake on Tomcat returns Unexpected Response Code 500

I have a WebSocket application that registers the endpoint programmatically, without the use of Annotations. The relevant code is: ServerEndpointConfig.Configurator configurator = …
isapir
  • 21,295
  • 13
  • 115
  • 116
0
votes
0 answers

How to pass an Object from a Servlet to JSR-356 WebSocket

I have a JSP-type servlet that registers a WebSocket Endpoint with the Servlet container. I want to pass a reference of that servlet, and/or some of its objects, to the WebSocket Endpoint, so that I can use the code from that servlet, e.g. for…
isapir
  • 21,295
  • 13
  • 115
  • 116