java-websocket

grails 3.0.9 WebSocket 404 error

[亡魂溺海] 提交于 2019-12-23 05:05:06
问题 i am trying to create chat application with grails. i am using grails 3.0.9 and tomcat-8.0.28 Sorry for duplicate i read this question and this... but thats not solve my problem.. i already change javax.websocket-api to provided like this : provided 'javax.websocket:javax.websocket-api:1.0' but i still get this error : Firefox : Firefox can't establish a connection to the server at http://103.56.148.50/chat/chatEndPoint/C001D939F2564251C86E646B9127495D" Chrome : Error during WebSocket

Server not receiving message sent by socket client

淺唱寂寞╮ 提交于 2019-12-20 03:18:30
问题 I have socket server (java desktop app) that is waiting for connection from java webapp (socket client). The communication looks ok, I see message from the server on the client side, but when I send the message, I don't receive anything on my server side. What can be the problem? When I checked server with telnet, everything is working ok. Below is my code: SERVER: public class ThumbnailGenerator { static Logger log = Logger.getLogger("ThumbnailGenerator"); public static List<ThumbnailTask>

Tyrus websocket: IllegalStateException cannot set WriteListener for non-async request

淺唱寂寞╮ 提交于 2019-12-17 17:15:31
问题 I have a standard websocket endpoint based on Tyrus implementation which times to times triggers the java.lang.IllegalStateException: Cannot set WriteListener for non-async or non-upgrade request . We are running on Payara 4.1. My standard implementation @ServerEndpoint(value = "...", decoders=MessageDecoder.class, encoders=MessageEncoder.class) public class EndpointImpl extends AbstractEndpoint{ // onOpen, onClose, onMessage, onError methods } Where the abstract class is public abstract

EnityManager Injection via HK2 in WebSockets

风格不统一 提交于 2019-12-13 03:12:53
问题 I have written 2 WebSocket ServerEndpoints that inject Services that themselves interact with the Database using injected instances of the JPA EntityManager. The application is a web application deployed on a Tomcat Server, using Jersey as JAX-RS implementation and Hibernate as JPA Provider. Sometimes it happens that the EntityManager is closed when trying to the DB inside the Endpoints. Also I fear I might have produced code that triggers a Memory Leak. This is the custom ServerEndpoint

Connection to WebSocket Failed: unexpected response code : 404

孤人 提交于 2019-12-12 06:48:19
问题 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 WebsocketHomeController { def index() { } @OnMessage public String echo(String incomingMessage) { return "I got this (" + incomingMessage + ")" + " so I am sending it back !"; } } this is my index.gsp <html> <head> <meta http-equiv="Content-Type" content="text/html;

What Uri path to use to connect to Spring WebSocket

穿精又带淫゛_ 提交于 2019-12-12 04:39:48
问题 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 javax.websocket.OnClose; import javax.websocket.OnError; import javax.websocket.OnMessage; import javax.websocket.OnOpen; import javax.websocket.Session; import javax.websocket.server.ServerEndpoint; import org.springframework.web.socket.server.standard.SpringConfigurator;

jetty 9 add websockets handler to handler list

不羁岁月 提交于 2019-12-12 04:08:51
问题 All handlers in that example work apart from the websockets handler WebSocketHandler wsHandler = new WebSocketHandler() { @Override public void configure(WebSocketServletFactory factory) { factory.register(WebsocketsService.class); } }; HandlerList handlers = new HandlerList(); handlers.setHandlers(new Handler[] { resource_handler, servletContextHandler, wsHandler, new DefaultHandler() }); server.setHandler(handlers); it fails with WebSocket connection to 'ws://localhost:8080/' failed: Error

missing upgrade : Serve both http and ws on netty 4.x

妖精的绣舞 提交于 2019-12-11 10:25:59
问题 I'm writing a chat application on netty. I tried to serve both HTTP and WS , but http responses is only these message not a WebSocket handshake request: missing upgrade Here is my code snippets. in InitChannel method p.addLast(new HttpServerCodec()) .addLast(new HttpObjectAggregator(65536)) .addLast( new LoggingHandler(LogLevel.INFO)) .addLast(new WebSocketServerProtocolHandler("/chat"), new WsUserAcceptHandler(), new WsChatServerHandler()) .addLast(new HttpStaticFileHandler("/", ChatServer

Apache Camel Content Based Routing on Websocket Connections

∥☆過路亽.° 提交于 2019-12-11 10:16:05
问题 I have a hypothetical scenario: let’s pretend I have an Apache Camel websocket server and I’m allowing many websocket connections. Each client connection will need to be associated with a ClientID. The ClientID is obtained by a new connection via an InitConnection json message where a ClientID is a member of the message. The question is: is it possible to have camel associate a websocket instance with a ClientID in order to perform content based routing? 回答1: yes, It is possible. you can

What draft does java-websocket's WebSocketServer use?

限于喜欢 提交于 2019-12-11 02:53:11
问题 I can't figure out from the WebSocketServer.java source which draft it uses. The WebSocketClient.java can use RFC 6455, Hybi 17, Hybi 10, Hixie 76, and Hixie 75 yet defaults to RFC 6455. What draft does java-websocket's WebSocketServer use? 回答1: It supports whatever drafts you want it to support. The constructor supports passing in a list of Drafts that you want the server to handle. https://github.com/TooTallNate/Java-WebSocket/blob/master/src/main/java/org/java_websocket/server