sockjs

Can I add request parameter to SockJs constructor so that it can be send to server

对着背影说爱祢 提交于 2019-12-12 13:27:18
问题 I initialize my SockJs URL as var protocols = ['xhr-polling', 'xdr-polling', 'xdr-streaming', 'xhr-streaming']; var options = {protocols_whitelist: protocols, debug: true,server:tets}; _ws = new SockJS(url, null, options); I want to send out a request parameter , for example somesite/sockjs/info?someparam=tets" Is it possible? Documentation of SockJs refers that options is map which can have key value but i am not sure what key to use here. I verified URL at server which SockJs sends over and

In spring using websockets getting this error,uncaught type error: onrecieve is not a function(..) stomp.js

爱⌒轻易说出口 提交于 2019-12-12 04:34:30
问题 I am getting this error: uncaught type error: onrecieve is not a function(..) stomp.js Can anyone help me and provide me complete setting using stockjs, stomp and jars? My file:home.jsp <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Reload..</title> <%--

Error opening websocket connection using spring 4

自古美人都是妖i 提交于 2019-12-11 20:10:09
问题 I am trying to create a websocket using this tutorial . Everything is good except that when I try to open websocket connection I get the following error on my browser console and nothing happens at all. Please help me out. Error: Opening web socket... GET http://localhost:8080/hello/info?t=1445510124841 404 (Not Found) Whoops! Lost connection to http://localhost:8080/hello TestController.java package com.test.controller; import java.util.Set; import javax.servlet.http.HttpServletRequest;

Initialize socket connection only when a condition is met

删除回忆录丶 提交于 2019-12-11 15:55:19
问题 I am trying to create a socket connection in my react/redux web application and I am trying to initialize a socket connection only when a user is logged in. My socket instance currently resides in a middleware but when I try to check if a user is logged, I get an error like this Uncaught TypeError: Cannot read property 'apply' of undefined . Here is the snippet of the middleware code: const socketMiddleWare = url => store => { if (store.getState().user.username) { const socket = new SockJS

SockJS not passing credential information when on a different domain(CORS)

ε祈祈猫儿з 提交于 2019-12-11 06:24:51
问题 We have a websocket server side implementation using spring 4. It has been configured to use spring security for auth/authz. On the client side, we use sockJS which works perfectly when the client is in the same domain as the server. Call to websocket is made this way… socket = new SockJS("http://guest:guest@mydomain.org/MyWebSocketApp/tracker") This eventually makes a call to http://guest:guest@myinterestingdomain.org/MyWebSocketApp/tracker/info to decide the transport to use. All this is

sockjs - example of implementing rooms

£可爱£侵袭症+ 提交于 2019-12-11 05:32:27
问题 I would like to have users create and join a "rooms" so that they can collaborate. I'm looking at SockJs Multiplexer server and wondering if I can leverage some of that to create and broadcast to specific channel/room. In the example, a channel is created manually and client connects to that channel. Would treating these channels as rooms work? Is there a way to dynamically create these channels instead of manually declaring them on server? 回答1: Disclaimer: I didn't notice that you were

No cookies during /info request using sockjs and stomp

时光毁灭记忆、已成空白 提交于 2019-12-10 18:02:56
问题 I'm trying to use Spring Security with websockets. As an example I'm using spring-websocket-chat (https://github.com/salmar/spring-websocket-chat) — demo application from talk "Deep dive into websockets". In that application CookieHttpSessionStrategy uses for storing session id, stored during authentication cookie is sending with /info request. Here are code that demonstrates connecting to server via sockjs (this request sends cookies) https://github.com/salmar/spring-websocket-chat/blob

spring 整合websoket(整理)

大城市里の小女人 提交于 2019-12-10 16:21:17
定义: sockjs.js: 浏览器JavaScript库,它提供了一个类似于网络的对象。SockJS提供了一个连贯的、跨浏览器的Javascript API,它在浏览器和web服务器之间创建了一个低延迟、全双工、跨域通信通道。 STOMP:简单(流)文本定向消息协议,它提供了一个可互操作的连接格式,允许STOMP客户端与任意STOMP消息代理(Broker)进行交互。有点像TCP和HTTP之间的关系,在websocket的通信中,有了STOMP协议后,客户端和服务端能够以更友好的方式进行交流。如果没有提供第三方的STOMP代理,比如Rabbitmq等,那么使用的就是spring容器自己提供的STOMP代理。 关系: 能够使用sock.js建立websocket的客户端连接。websocket可以使用STOMP协议作为传输的协议。 样例代码如下: 定义WebSocketMessageBrokerConfigurer,一般是继承自AbstractWebSocketMessageBrokerConfigurer: @Configuration @EnableWebSocketMessageBroker //在 WebSocket 上启用 STOMP public class WebSocketConfig extends

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

Stomp spring web socket message exceeds size limit

为君一笑 提交于 2019-12-08 23:53:41
问题 I am implementing spring web-socket into our spring mvc web application. However I am running into message over size limits when I am trying to send a really big message to an endpoint. I am getting the following error, message:The 'content-length' header 68718 exceeds the configured message buffer size limit 65536 14:49:11,506 ERROR [org.springframework.web.socket.messaging.StompSubProtocolHandler] (http-localhost/127.0.0.1:8080-4) Failed to parse TextMessage payload=[13684590},..],