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
0 answers

Websockets not working properly on tomcat8 server

Below are the two scenarios that I am trying. I have deployed application on server(tomcat8) using eclipse IDE. and then connecting the client with server using websocket protocol. It is working fine. I have installed tomcat8 on a server machine,…
Kunal Goel
  • 19
  • 4
0
votes
1 answer

How to get web content path with wildfly 9/websocket as it is done with request.getServletContext().getRealPath(UPLOAD_PATH)?

I seen this topic: How can I get real system file path from within a WebSocket Endpoint With the same problem. I tried to use: @OnOpen public void onOpen(Session session, ServerEndpointConfig config){ contextPath = config.getPath(); } But when…
bioinfornatics
  • 1,749
  • 3
  • 17
  • 36
0
votes
0 answers

Exit while loop

I was wondering how to exit a while loop properly in another class. My "slave" app is connected with WebSocket through my "master app". This "slave app" is checking if there is new files in a directory. For the future, it will analyse these new…
tmylamoule
  • 161
  • 1
  • 12
0
votes
1 answer

Writing WebSocket Server on Java. Issue on Windows 7 64 bits

I having a problem with WebSocket protocol. When I execute the code when develop (NetBeans) and works fine, even when I execute the jar file still works, but... When I execute the jar on Windows 7 64 bits platform... The WebSocket close by…
0
votes
1 answer

Clients behind proxy can not connect to websocket server end point running on weblogic server .How to fix this?

I have web socket server written in JAVA EE 7 and client in HTML and javascript .I am running on weblogic server. All clients on my local machine are able to connect to the server and send messages but the remote clients in the same network are not…
0
votes
0 answers

Oauth in Tyrus WebSocket

I am trying to use Oauth using Tyrus Web Socket. I tried using: AuthConfig authConfig = AuthConfig.Builder.create(). disableBasicAuth(). build(); Credentials credentials = new Credentials("Authentication", "Bearer Key");…
0
votes
1 answer

How To Send Request Header To Jetty WebSocket From JavaScript Client

How To Send Request Header To Jetty WebSocket From JavaScript Client ? What I am doing ? At Client Side. Need To add service name and service version in request header at client side Send to server At Server Side. Identify the service from the…
Shineed Basheer
  • 578
  • 5
  • 16
0
votes
1 answer

Not getting a response when communicating with Google using java sslSocket

I am trying to write a simple web client using java's socket classes similar to telnet. I want the user to be able to communicate freely with any web server on any port. I would like to also have some built in support for HTTP/HTTPS communication.…
0
votes
1 answer

Connection state is closed when sending authorization request using DDP protocol

I am using kenyee's Android DDP Client library to connect my Android application to a server running Meteor-JS. I've modified his Meteor.js Parties ANdroid Demo. I attempt to login with existing user credentials and get Login Error. Please, help! I…
naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
0
votes
1 answer

How to import the Gottox/socket.io-java-client api in current Eclipse Android Project?

I'm trying to write a JavaScript server running on node.js using Socket.io that communicates with the client which is my android app (java class). Since I need a combination of a JS server and java client that utilizes the Socket.io (or any other…
Darth Coder
  • 1,738
  • 7
  • 33
  • 56
0
votes
0 answers

Creating a Digest WebSocket connection on Android

I'm trying to connect, as the question suggests, an Android device to a Digest secured server with websockets but I keep getting 401 Unauthorized returns. I have managed to POST and GET to the same server using apache.http (which supports Digest)…
Seb Andraos
  • 357
  • 3
  • 15
0
votes
2 answers

Display message in Textview when Websocket message recieved

this is my websocket client in android. It's a quick test and the reply from server should be display on the TextView. Boolean status1 = false; static String msg = "reply "; @Override protected void onCreate(Bundle savedInstanceState) { …
tinkerbell
  • 421
  • 4
  • 12
0
votes
1 answer

SSL handshake error when connecting by websocket using encrypted connection

I use Tyrus webSocket implementation to connect to the server from my JavaFX application. When I try to establish connection over SSL I get this error: javax.net.ssl.SSLException: SSL handshake error has occurred - more data needed for validating…
Dmitry
  • 1,484
  • 2
  • 15
  • 23
0
votes
1 answer

Without getting a meaasge how to send meassage to client in java spring web socket

I am having a use case where I need to send message to client web socket from server and so in return client will return the client info to server. I am trying to do a reverse of client server technology in web socket, where client will first invoke…
0
votes
1 answer

Java WebSocket API

Is that correctly to have multiple ServerEndpoints in web app? Like this: @ServerEndpoint("/users") public class UsersEndPoint{ //some impl } @ServerEndpoint("/users/{userId}") public class UserEndPoint{ //some…
user3435425
  • 192
  • 1
  • 18
1 2 3
34
35