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
3
votes
3 answers

Why websocket don't work on the cloud?

I developed our websocket project on wildfly. When we test it on localhost or within our local network, everything work fine. But when I deployed it on AWS, websocket don't work any longer. We can access other html pages. But when we conenct to…
FranXho
  • 736
  • 7
  • 18
2
votes
1 answer

Integrating Java WebSockets (JSR-356) with SpringBoot

I'm having an issue getting a websocket deployed in SpringBoot. I've tried quite a few approaches based on https://spring.io/blog/2013/05/23/spring-framework-4-0-m1-websocket-support, Using Java API for WebSocket (JSR-356) with Spring Boot, etc with…
Half_Duplex
  • 5,102
  • 5
  • 42
  • 58
2
votes
0 answers

How can I register JSR-356 Websocket in PAX-Web? (In bundle, not WAR)

I have a problem with the PAX-Web. I've tried to register a Websocket service as declrarative, but it is unaccessible from web. I've tried the given websocket-jsr356-6.0.3.war and it works fine. As I see the WAR file handles differently the…
2
votes
2 answers

Undertow Websocket Bean Injection CDI Issue

I don't understand why CDI use of injection doesn't work with websockets, using undertow. Below is the code I have for a simple websocket endpoint. @ServerEndpoint("/") public class TestWebSocketEndpoint { @Inject private RetrieveAccessor…
thekevshow
  • 774
  • 14
  • 36
2
votes
1 answer

Encoding collection to json array in jsr 356

I am learning websockets and my webapp is using jsr 356 library. I followed the tutorials and I can encode/decode POJOs, however I can't find examples on how to serialize either arrays or collections to JSON. This is what I am doing to encode my…
masber
  • 2,875
  • 7
  • 29
  • 49
2
votes
2 answers

How do I setup JSR356 websockets in a jetty container

I see lots of tutorials about how to set up JSR356 websockets with an embedded web server of some sort. But I want to add some websockets to an existing WAR deployed to a stand alone jetty installation, jetty jetty-9.2.3.v20140905, and I can find…
user2197116
  • 667
  • 3
  • 8
  • 21
2
votes
1 answer

Server-initiated WebSocket broadcast in JSR-356

What's the best practice to broadcast a server-initiated WebSocket message in JSR-356? To clarify, I know how a reply or even a broadcast works when using the @OnMessage annotation, but I want to send an event from the server without a receiving a…
Sundae
  • 724
  • 1
  • 8
  • 27
2
votes
1 answer

JUnit test with javax.websocket on embedded Jetty throws RejectedExecutionException: NonBlockingThread

I'm trying to write a test case which creates a socket and connects to an embedded jetty instance. I'm using Jetty: 9.2.0.RC0 javax.websocket-api & javax.websocket-client-api: 1.0 javax.websocket server & client impl: 9.1.5.v20140505 Starting the…
Dominic
  • 3,353
  • 36
  • 47
1
vote
0 answers

Java WebSocket client closes connection abruptly

I'm trying to simulate client-to-client communication via server using WebSocket. The idea is: Client A want to send a message to Client B. A sends a message to the server, the server finds out whether B has an active session or not by looking up…
Shankha057
  • 1,296
  • 1
  • 20
  • 38
1
vote
0 answers

Websocket Client Endpoint with SSL

I have written a annotated sample client endpoint as below, public WebsocketSSLClientEndpoint(URI endpointURI) throws URISyntaxException { final ClientManager client = ClientManager.createClient(); try { …
SHG
  • 59
  • 7
1
vote
1 answer

TimeoutException while sending data via WebSocket

I'm encountering java.util.concurrent.TimeoutException while sending data via WebSocket (Tomcat8 JSR-356). Refer the trace given below java.io.IOException: java.util.concurrent.TimeoutException at…
UnahD
  • 867
  • 2
  • 10
  • 25
1
vote
1 answer

"Failed to decompress a compressed WebSocket frame" error in Tomcat WebSocket

I have a JavaScript WebSocket client and Tomcat WebSocket server (JSR 356). Whenever I try sending text data to the server from the JS client, I'm receiving the following error Failed to decompress a compressed WebSocket frame The WebSocket…
UnahD
  • 867
  • 2
  • 10
  • 25
1
vote
1 answer

Websocket JSR-356 fail with Jetty 9.4.1

My current web server is embedded Jetty 9.1.5. It works well with JSR-356 to create websocket. These days, I am trying to upgrade to Jetty 9.4.1. Everything works nicely except websocket. My code like below: Embedded Jetty and Websocket…
Khoa Bui
  • 733
  • 1
  • 7
  • 15
1
vote
0 answers

Equivalent of a 404 for a websocket

I am using websockets to pass information about a resource from the server to the client. The websocket Endpoint uses a pathparam to identify the specific resource. For example: @ServerEndpoint("/resources/{resource-id}/updates") The Endpoint…
daiscog
  • 11,441
  • 6
  • 50
  • 62
1
vote
0 answers

WebSocket closing down on sending Base64 encode Strings

I'm trying to send a base64 encoded string (converted from a image) via websocket and this is working fine for me with a javascript client. But if I use a java client (@clientEndPoint) instead, onMessage function is triggered once and the websocket…
avgs
  • 21
  • 7