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
1 answer

java websocket api and old browsers

Java introduced Java API for WebSocket to implement WebSocket but all browsers don't support WebSockets properly. Some browsers don't support it at all, the support in the other ones may be incompatible (non standard or incomplete). So why use…
Masood Ahmad
  • 731
  • 4
  • 15
  • 38
0
votes
1 answer

System.out.println in java websockets

System.out.println in java websockets is not working. My aim is on user connects it should send first 'welcome' and then the chat have to be started. This is tomcat7 websockets chat example: @OnOpen public void start(Session…
Manohar Gunturu
  • 125
  • 3
  • 16
0
votes
1 answer

How to prevent a value from strongly referring to its key?

A much better programmer than me informed me that he holds a map of his WebSocket connections with java-websocket in a WeakHashMap. I've looked into that map for myself and it seems perfect since a connection will close without the thread…
user1382306
0
votes
1 answer

Socket.io android library send method

I am trying to use a socket.io https://github.com/koush/AndroidAsync#androidasync-also-supports-socketiolibrary lib and trying to send a string using webSocket.send("a string"); by creating a new web socket using AsyncHttpClient. and sending string…
Chinmay
  • 423
  • 5
  • 19
0
votes
1 answer

How to restrict WebSocket server connection to only one?

For creating WebSocket server I have used Java-WebSocket library. It looks like this, and it is working. But now I wish to upgrade, so server can have only one active client connection. Is there some kind of option for doing this, or should I check…
Glavić
  • 42,781
  • 13
  • 77
  • 107
0
votes
1 answer

Implementing a websocket

I found TooTallNate's Java-Websocket library. I am attempting to implement a client and server as a proof of concept to see if web sockets will solve a problem for us. My client is my Ubuntu 12.04 Linux workstation. I wrote a websocket server…
Thom
  • 14,013
  • 25
  • 105
  • 185
-1
votes
1 answer

org.java_websocket.client.websocketClient 1.3.0 close() method doesn't work

Current Problem I created a program that uses a web socket to get data. The connection to the server at the connection destination was lost, but the connection was not determined. To terminate the connection if the last message received exceeds a…
-1
votes
1 answer

ERR_NAME_NOT_RESOLVED on a websocket

I'm trying to mod a game but the websocket says name not resolved even though it looks like it should work. Can someone tell me the problem? function doit() { document.body.innerHTML += '
'; messageDisplay =…
-1
votes
1 answer

Jmeter: How to save jtl logs in parts in non-gui mode

I'm getting result in GBs under jtl files, so how I can save jtl files in parts so that I can delete older files during Jmeter run. jmeter -n -t test.jmx -j D:\jmeter.log -l D:\jmeterJTL.jtl Above command will save the jmeter.log and jmeterJTL.jtl…
-1
votes
2 answers

Jboss EAP 6.4 - Websocket 500 internal server error

=== Java Console log === JBWEB000236: Servlet.service() for servlet default threw exception: java.lang.IllegalStateException: JBWEB000034: Cannot upgrade from HTTP/1.1 without IO events === HTML Code ===
bamossza
  • 3,676
  • 1
  • 29
  • 28
-1
votes
1 answer

Lightweight IPC to WebSocketListener in Jetty

Android, iOS and desktop browser clients are currently polling a PHP-backend (utilizing PostgreSQL database on CentOS Linux) every few seconds. I would like to replace the polling by using standalone Jetty Websocket Server to notify clients, that…
Alexander Farber
  • 21,519
  • 75
  • 241
  • 416
-1
votes
1 answer

Connection to WebSocket Failed: unexpected response code : 404

iam trying to create a chat with javax.websocket. i am using grails. 3.0 this is my controller package chatting import javax.websocket.server.ServerEndpoint; import javax.websocket.OnMessage; @ServerEndpoint("/echo") public class…
user2809386
-4
votes
4 answers

how to access java web application with ip address without entry the port

I'm using glassfish 4.1 server with port 8080. my apps can access by hit localhost:8080 or using my_ip_address:8080. now, I want access my apps only with ip address without entry the port, say my ip is 10.1.2.133, so when I hit 10.1.2.133 it's go to…
1 2 3
34
35