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

Websocket Server Implementation Android

I need to implement a secure Websocket Server in Android. I have used https://github.com/TooTallNate/Java-WebSocket . This is working fine for insecure connection. But once I make the webserversocket as secure, I get SSL Handshake exception. Does…
user1527969
  • 66
  • 1
  • 6
0
votes
1 answer

How to create a websocket in GWT

I need help understanding how to create a websocket in GWT. Basically I need to look into creating a system for push notifications, I tried looking into Atmosphere for that but I currently have my workspace setup not using maven, and all the…
Emre801
  • 3,043
  • 5
  • 25
  • 28
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
0
votes
1 answer

Websocket used in Servlet, is "public static void main(final String[] args)" needed?

This is my first time working with Java Websockets (not using Jetty, using JSR-356 instead), and all of the examples that I have seen utilize the "public static void main(final String[] args)" to map the Websocket client and server endpoints. If I…
0
votes
0 answers

Websocket connection does not read complete data

I am using java-websocket library on android client side for communicating with python ws server. I am using above library to handle asynchronous response from server. The following are the @override methods of websocket class: @Override …
Mangesh Sambare
  • 594
  • 3
  • 23
0
votes
1 answer

How do I create a Multiplexed WebSocket connection in Jetty 9.2.2?

I currently have a WebSocket connection where a web client connects to my Jetty server and streams results back. It uses the standard Java Jetty websocket api and works beautifully. Well I'm at the point now where I'd like a user to be able to…
Baerek
  • 15
  • 3
0
votes
1 answer

How to use values coming in ws.onmessage event into another function

I am working on web socket related project.In following snippet I am getting the data coming from the server. I want to use the this data(in str variable) into another function. Kindly suggest any solution. Thank you in advance. /*ON RECEIVING…
user5902391
0
votes
1 answer

What Uri path to use to connect to Spring WebSocket

I have a WebSocket Application using Spring MVC that I have defined as per this tutorial. The file that configures the WebSocket is the following: package com.myapp.spring.web.controller; import java.io.IOException; import…
user5139637
  • 775
  • 3
  • 10
  • 29
0
votes
2 answers

Gradle build failed to resolve library

I am working on android (Java) and trying to consume websockets so I thought I would use this tutorial and they are using dependency org.java-websocket:Java-WebSocket:1.3.0 from this repo which has now become 1.3.1. So I have in my modular…
0
votes
1 answer

Websocket dilemma between javascript and jetty embedded websocket server

I have a javascript API that it's included in some websites. For some reasons there is a need for communicate that browser side with a desktop application written in Java. As you can see, all is local to the host. My first solution was to use…
Jordy Baylac
  • 510
  • 6
  • 18
0
votes
0 answers

Where does @serverendpoint path get mapped (Websockets)

I have the following @serverendpoint path for a websocket that I am using with the spring framework: @ServerEndpoint(value="/serverendpoint", configurator = SpringConfigurator.class) My first question is say I have a website with the url…
user5139637
  • 775
  • 3
  • 10
  • 29
0
votes
0 answers

How to create a websocket server in a desktop java application

I don't want to use a full Web Server like Apache Tomcat or any similar technology. I just need to provide a websocket server in my desktop app and allow a web page to connect to it, in the same machine, that's it. I've been using TooTallNate…
Jordy Baylac
  • 510
  • 6
  • 18
0
votes
1 answer

Websockets - not working in weblogic 12.2.1?

Weblogic - 12.2.1 - not initializing the ServerContainer ! Hello Everyone , I am facing an issue while starting my application on weblogic 12.2.1 , as per the websocket spec i am initializing the websocket end-point at the time of startup of…
TEJA
  • 1
  • 6
0
votes
1 answer

heroku is not able to process web socket

Im trying to use web socket with spark and im using /chat as the end point url. Following is my code. @ServerEndpoint("/chat") public class Main { public static void main(String[] args) { port(Integer.valueOf(System.getenv("PORT"))); …
user6517192
0
votes
0 answers

WebSocket Failed When try to connect to a public ip

I'm doing a websocket with javax.websocket and a JavaScript client; when I call the websocket in JavaScript with a private IP it works, like this: var websocket = new WebSocket("ws://10.3.3.25:8083/MyJavaWebSocket/MyEndPoint"); But when I try to…
Trigon219
  • 149
  • 1
  • 4