Questions tagged [java-websocket]

Use this tag for questions related to Java based server side implementation of WebSocket.

Java SE has no standard API for WebSocket, there's a 3rd party library: Java-WebSocket.

Writing your own WebSocket Server

The org.java_websocket.server.WebSocketServer abstract class implements the server-side of the WebSocket Protocol. A WebSocket server by itself doesn't do anything except establish socket connections though HTTP. After that it's up to your subclass to add purpose.

Writing your own WebSocket Client

The org.java_websocket.server.WebSocketClient abstract class can connect to valid WebSocket servers. The constructor expects a valid ws:// URI to connect to. Important events onOpen, onClose, onMessage and onIOError get fired throughout the life of the WebSocketClient, and must be implemented in your subclass.


Java EE has a standard API for server side implementation of WebSocket: JSR356.

524 questions
0
votes
2 answers

Return response from long running process to client with Grails 3

I have a Grails 3 web application. After a client sends a request to my application, a long-running process starts, the process completion can take a few seconds or a few hours. I don't want to block the client to wait for the response. Therefore, I…
Memin
  • 3,788
  • 30
  • 31
0
votes
1 answer

Inconvenient Robot framework test case using websocket and jms

I'm having trouble rewriting java test cases in robot framework. in order to do this, i need to create new java keywords, but the way tests are implemented, don't make it easy ! this is an example of script that i need to rewrite in RF : try { …
khaled
  • 33
  • 3
  • 7
0
votes
0 answers

java websocket not working on tomcat, no connection error

I'm building my java web application on my home server. My home server is using apache2 as the web-server and tomcat(9.0.5) as the java-container, along with mysql database, all on Ubuntu OS 16.04 LTS. I try to build the .war file then deploy…
0
votes
2 answers

Java websocket: How to receive PongMessage from websocket client and respond to this message

I am trying to send PongMessage to a server from web-socket client (heart-beat message you may say). In server, I have written a method like this inside a class Annotated with @ServerEndpoint : @OnMessage public void onPong(PongMessage…
ishwor kafley
  • 938
  • 14
  • 32
0
votes
0 answers

Spring-Boot without STOMP (raw websocket)

Edit: Please do not downvote without leaving at least a comment. I'd like to implement websocket in a SpringBoot application without Message Broker and STOMP. However, I need to access Spring Beans (repositories and services). The Java API is so…
Sidney de Moraes
  • 993
  • 3
  • 11
  • 29
0
votes
0 answers

Sending message to client(JSF view ) from server(websocket) with ejb timer service

I want to know how to send a message from the server (using websocket) to the clientside (JSF 2.2) with EJB 3.2 Timer Service (every 10 seconds). Please explain using Java EE 7 API.
0
votes
0 answers

java Asynchronous Socket troubleshooting

I used java to make simple chat program with AsynchronousChannelGroup, But some received data does not reach to completed. or reach very slow (1s ~ 2s). (I think it's random to client. Some client reach well to server but some client reach very slow…
fnclovers
  • 119
  • 9
0
votes
1 answer

How to push message from different class? (EE7 Websocket)

I have implemented a websocket endpoint using the API provided with Java EE 7 for a game using HTML5 websockets. I can successfully send messages using a timer task in order to update the ball position, bricks, etc. but I would like to be able to…
josephzigler
  • 285
  • 3
  • 13
0
votes
0 answers

How to respond an ArrayBuffer from Java EE WebSocket API

Actually, I have the following problem in a WebSocket application, when I'm working with the dependency of JavaEE WebSocket API and I have the following component: @ServerEndpoint("/echo") public class Echo { @OnMessage public void…
0
votes
0 answers

grails javaee websocket getting 404 error in production mode

Im implementing a websocket server in grails and im getting error on client side connecting to it but only in production mode. This is the error im getting: WebSocket connection to 'ws://localhost:8080/myApp/websocketDoc' failed: Error during…
0
votes
1 answer

Unable to send data from doInBackground method of AsyncTask via Websocket

I am trying to send data and receive an echo of the same via a websocket. When I try to send it via a background thread, I receive no echo. What could be wrong? Is it incorrect to send Data via a background thread? If so, why? Please check my code…
0
votes
2 answers

AWS EC2 instance unable to handle WebSocket Http Upgrade request

Config: Plain EC2 instance no ELB Glassfish 4 hosting a javax.websocket Port 8080 is open to all TCP traffic Glassfish http-listener has Websockets Support: True When I host on my local network I am able to connect with every device (including my…
0
votes
0 answers

Why my javascript console says that web sockets are closed or already in closing state?

I am creating a chat application for my company, I am facing an issue that Web Socket is closed or already in closing state, whenever I try to connect. But the scenario is that the same source code same application is working fine on my friends…
Muhammad Yawar
  • 424
  • 1
  • 3
  • 19
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
0 answers

Sending websocket request from webpage to simple java server

I have this following javascript in my html file and i am trying to get the websocket working in the html file. 1 /home/bgautam/Documents/019.dcm.tar.xz