sockjs

Websockets: Is it possible to add multiple Endpoints using SockJS?

▼魔方 西西 提交于 2020-01-16 18:48:51
问题 I want to create 2 web socket endpoints. Can you tell is it possible? What shall be the configuration in that case? 回答1: Your question does not clearly states if you're using plain websockets or STOMP messaging. Plain websocket API If you're using the plain websocket API, the registry API allows you to add as many websocket handlers as you want. @Configuration @EnableWebSocket public class WebSocketConfig implements WebSocketConfigurer { @Override public void registerWebSocketHandlers

Spring Websocket ChannelInterceptor not firing CONNECT event

为君一笑 提交于 2020-01-16 11:31:29
问题 I'm writing simple Stomp Websocket application with Spring, and clients are both web (JS), and Mobile (ios, android). From JS code client connecting over SockJS, while mobile clients are using plain websocket connection behind SockJS. The issue is that behaviour in my ChannelInterceptor where I'm checking authentication, is completely different for different type of connections. I can't make it work the same for every client. Let me briefly give some code behind it and explain by example:

vue-cli3 中 sockjs-node/info?t=报错 的解决方法

可紊 提交于 2020-01-08 10:52:11
页面突然出现这种报错: 查看Network看到是info接口报错,我项目中没有调用过该项目,然后百度查询sockjs-node/info?t=1562204191563, 首先 sockjs-node 是一个JavaScript库,提供跨浏览器JavaScript的API,创建了一个低延迟、全双工的浏览器和web服务器之间通信通道。 服务端:sockjs-node(https://github.com/sockjs/sockjs-node) 客户端:sockjs-clien(https://github.com/sockjs/sockjs-client) 如果你的项目也没有用到 sockjs,vuecli3 运行 npm run serve 之后 network 里面一直调研一个接口:https://10.98.36.52:9535/sockjs-node/info?t=1578449724494 解决方案如下: 1. 找到/node_modules/sockjs-client/dist/sockjs.js 2.找到代码的 1605行 try { // self.xhr.send(payload); } catch (e) { self.emit('finish', 0, ''); self._cleanup(false); }   这样就 OK 啦 ! 来源: https:/

Bridging messages from eventbus to subscribed websocket clients using VertX

扶醉桌前 提交于 2020-01-07 03:08:09
问题 I'm trying to use websocket to create a publish-suscribe model which can be reached through both SockJS and Websocket (for Javascript clients on one side, and for Java clients on the other. Currently I'm able to subscribe using SockJS and Javascript clients. However, when trying to use websocket to receive messages in my Java client, I am able to connect to the websocket server, but don't receive any messages from the server. My current client code: public class

SubProtocolWebSocketHandler - No handlers

对着背影说爱祢 提交于 2020-01-03 04:40:06
问题 I have this ugly error during deploying Spring app on JBoss. 18:11:16,025 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/consumer]] (MSC service thread 1-7) Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener: org.springframework.context.ApplicationContextException: Failed to start bean 'subProtocolWebSocketHandler'; nested exception is java.lang.IllegalArgumentException: No handlers at org

How to secure websocket application [Spring boot + STOMP]

天涯浪子 提交于 2020-01-01 10:15:07
问题 Good morning, I've created a simple Spring Boot WebSocket application. Right now I would like to set some security to it. I've trying some examples but I cannot get it worked. I'm getting error: web browser: >>> CONNECT ${_csrf.headerName}:${_csrf.token} accept-version:1.1,1.0 heart-beat:10000,10000 <<< ERROR message:Failed to send message to ExecutorSubscribableChannel[clientInboundChannel]; nested exception is org.springframework.security.web.csrf.MissingCsrfTokenException\c Could not

Spring websockets SockJS fallback protocols are not working out of the box?

放肆的年华 提交于 2019-12-24 07:15:27
问题 I've made an app with spring boot with websockets support. Everything is working great. I'm using SockJS + Stomp . No worries. It's just working. But now I want to support the ability of SockJS use its fallback protocols. And it seems that it's not working out of the box. Here's how I added the endpoint: @Override public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/ws").withSockJS(); } And that's it. No more configuraion. And now when I disable

Spring Stomp over Websocket: Stream large files

我与影子孤独终老i 提交于 2019-12-23 21:21:18
问题 My SockJs client in webpage, sends message with a frame size of 16K. The message size limit is what determines the max size of the file that I can transfer. Below is what I found in the doc. /** * Configure the maximum size for an incoming sub-protocol message. * For example a STOMP message may be received as multiple WebSocket messages * or multiple HTTP POST requests when SockJS fallback options are in use. * * <p>In theory a WebSocket message can be almost unlimited in size. * In practice

native app to server communication

醉酒当歌 提交于 2019-12-23 13:08:12
问题 I am writing a mobile trading app (android/ios) and i need suggestions on the best way to connect the app to the server (messageQ) If i use raw TCP connection , would my users have a problem if they are behind corporate wifi's (protected by firewalls)? If yes, in that case, is web socket a better solution? With the backend server, after researching with zeroMq, i believe a full fledged broker like rabbitmq is a better option to start with. Now , if i use a web socket connection from my native

SockJS - '/info' causing Http 404 while connecting server

徘徊边缘 提交于 2019-12-23 08:44:48
问题 I've mainly followed below posts for implementing push notifications using SockJS, Push Notifications for Java Webapp, SockJS Client, SockJS Java Server. My sockJS client is: var sock = new SockJS("http://localhost:8080/pusher"); sock.onmessage = function(event) { console.log("message: " + event.data); alert('received message echoed from server: ' + event.data); }; *Server is listening same port 8080. But while running I got error 404: GET http://localhost:8080/pusher/info 404 (Not Found)