java-websocket

Why does sockJS add a '/info' to a given websocket url path

 ̄綄美尐妖づ 提交于 2019-12-10 12:59:39
问题 I want to open a websocket port with a "webapp/socket.do" path. When I use SockJS and try to initiate the call by code var socket = new SockJS('/webapp/socket.do'); stompClient = Stomp.over(socket); stompClient.connect({}, ... SockJS will by default add a "/info" to the end of the given path. I want to know why? Can this be changed or prevented? When using this with Spring MVC and have url pattern mappings to DispatcherServlet like < url-pattern >*.do</url-pattern> , this will return a 404

Container-Agnostic Websocket throws NPE with Embedded Jetty

瘦欲@ 提交于 2019-12-08 07:02:32
问题 I'm writing a container-agnostic Websocket server. My development environment uses IntelliJ IDEA with an embedded Jetty version 9.3.11.v20160721 (embed code below). My code, however, uses the Tomcat Websocket libraries, tomcat-websocket-api and tomcat-websocket , version 8.5.4 . I want to register the Websocket EndPoint with a ServletContextListener . Following some examples from the Tyrus project, as well as some answers on SO and in the Jetty mailing list by Joakim Erdfelt (@joakim-erdfelt)

Why not one method to connect and send in websocket?

时光总嘲笑我的痴心妄想 提交于 2019-12-08 03:30:53
问题 I am new websocket and refering to the below Spring Websocket tutorial and it is working fine in my system. I am also using stomp.js and sockjs-0.3.4.js. https://spring.io/guides/gs/messaging-stomp-websocket/ If the html and javascript has two distinct methods like below, it works. function connect() { var socket = new SockJS('/app/hello'); stompClient = Stomp.over(socket); stompClient.connect({}, function(frame) { setConnected(true); console.log('Connected: ' + frame); stompClient.subscribe(

Container-Agnostic Websocket throws NPE with Embedded Jetty

丶灬走出姿态 提交于 2019-12-07 12:44:30
I'm writing a container-agnostic Websocket server. My development environment uses IntelliJ IDEA with an embedded Jetty version 9.3.11.v20160721 (embed code below). My code, however, uses the Tomcat Websocket libraries, tomcat-websocket-api and tomcat-websocket , version 8.5.4 . I want to register the Websocket EndPoint with a ServletContextListener . Following some examples from the Tyrus project , as well as some answers on SO and in the Jetty mailing list by Joakim Erdfelt (@joakim-erdfelt), I wrote the following implementation and added it via a listener in web.xml . The code enters the

SSL Handshake Excetion : Failure in SSL library, usually a protocol error

笑着哭i 提交于 2019-12-05 07:34:42
问题 I am using a physical device with android v4.4.2 (Java) with java_websockets and I get this error when attempting to connect to the websocket. javax.net.ssl.SSLHandshakeException: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0x7aa38588: Failure in SSL library, usually a protocol error error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO: unknown protocol (external/openssl/ssl/s23_clnt.c:769 0x73a81cfc:0x00000000) I have found this answer and I tried implementing it but nothing

How to call @SendTo from Normal Request Call i.e @RequestMapping

╄→гoц情女王★ 提交于 2019-12-03 01:02:43
I have implemented Web Socket using Spring MVC and it is working fine for me i.e work from one browser to another browser which is open for those socket using this code. @MessageMapping("/hello") @SendTo("/topic/greetings") public HelloMessage greeting(HelloMessage message) throws Exception { Thread.sleep(3000); // simulated delay return message; } Can any one help me for who to call @SendTo("/topic/greetings") from normal api controller.I have try using this but it is not working for me @RequestMapping(value = "/sendMessage") @SendTo("/topic/greetings") public HelloMessage sendMessage()

Where does @serverendpoint path get mapped (Websockets)

…衆ロ難τιáo~ 提交于 2019-12-02 08:40:36
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 www.example.com . Where does the serverendpoint with path serverendpoint get mapped? Can I access my serverendpoint at wss://example.com:$PORT/currentpage.html/serverendpoint ? Or is this the wrong way. I have a Wildfly 10 server running. Based on another SO question , I was told to use the following Uri: var wsUri = "wss://" + document.location.hostname + "

Server not receiving message sent by socket client

℡╲_俬逩灬. 提交于 2019-12-01 22:44:46
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> taskqueue = new ArrayList<ThumbnailTask>(); public static void main(String[] args) throws IOException {

Spring Boot Stomp WebSocket

感情迁移 提交于 2019-11-30 18:23:33
问题 I seem to be running into an issue bumping up against the 8k size limit that embedded tomcat has for stomp websocket messages. When sending a message from server to client I am getting the following error. Based on the documentation I've read, it seems that tomcat has a limit of 8k for messages going across websockets, but ive also read that Stomp can send partial messages and have the client reassemble them which doesnt seem to be happening. The message is never getting to the client side

Difference between ws and wss?

怎甘沉沦 提交于 2019-11-30 12:29:12
问题 What is the procedure to change ws into wss? Whether wss is make upgrade over normal HTTP or wss works only HTTPS? webSocket = new WebSocket("ws://localhost:port/Esv/ocp"); works fine, when I changed ws to wss webSocket = new WebSocket("wss://localhost:port/Esv/ocp"); it shows this error: Error in connection establishment: net::ERR_SSL_PROTOCOL_ERROR 回答1: Short version To SSL or not SSL You may have a SSL certificate issue. The connection point rule can be summarized as: wss connects on https