Questions tagged [sockjs]

SockJS is a browser JavaScript library that provides a WebSocket-like object that gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.

SockJS is a browser JavaScript library that provides a WebSocket-like object. SockJS gives you a coherent, cross-browser, Javascript API which creates a low latency, full duplex, cross-domain communication channel between the browser and the web server.

Under the hood SockJS tries to use native WebSockets first. If that fails it can use a variety of browser-specific transport protocols and presents them through WebSocket-like abstractions.

SockJS-client is intended to work for all modern browsers and in environments which don't support WebSocket protocol, for example behind restrictive corporate proxies. [ https://github.com/sockjs/sockjs-client ]

SockJS-node is a Node.js server side counterpart of SockJS-client browser library written in CoffeeScript. [ https://github.com/sockjs/sockjs-node ]

650 questions
11
votes
3 answers

how to await subscriptions established?

I have the following js code: stompClient.subscribe('/topic/clients', function (calResult) { updateClientsTable(JSON.parse(calResult.body)); }); $.get("/clients", null); and following server code(last line invokes it): @GetMapping(value =…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
10
votes
2 answers

How to handle CORS origins with Stomp and SockJS in Spring 5.3 and newer?

I'm working on a server application which uses both REST endpoints and a SockJS websocket. This used to work fine under Spring 5.2 and below. However, since the 5.3 release, the following method exists within…
Martin Häusler
  • 6,544
  • 8
  • 39
  • 66
10
votes
4 answers

SockJS receive stomp messages from spring websocket out of order

I am trying to streaming time series data using Springframework SimpMessagingTemplate (default Stomp implementation) to broadcast messages to a topic that the SockJS client subscribed to. However, the messages is received out of order. The server is…
Zhichao
  • 599
  • 5
  • 14
10
votes
3 answers

Stomp over websocket using Spring and sockJS message lost

On the client side javascript I have stomp.subscribe("/topic/path", function (message) { console.info("message received"); }); And on the server side public class Controller { private final MessageSendingOperations
user2001850
  • 477
  • 4
  • 18
10
votes
3 answers

How to get session id on the client side? (WebSocket)

Is there any way to do this? Client side: function connectWebSocket() { var socket = new SockJS('/socket'); stompClient = Stomp.over(socket); stompClient.connect({}, function (frame) { console.log("connected"); }); } Server…
sinedsem
  • 5,413
  • 7
  • 29
  • 46
10
votes
2 answers

How can I send a message on connect event (SockJS, STOMP, Spring)?

I am connection through SockJS over STOMP to my Spring backend. Everything work fine, the configuration works well for all browsers etc. However, I cannot find a way to send an initial message. The scenario would be as follows: The client connects…
Adam Soliński
  • 444
  • 1
  • 8
  • 19
10
votes
2 answers

SockJS Client auto reconnect?

I'm trying to figure out a way for my SockJS clients to reconnect to the server if it should go down. I currently have this: new_conn = function() { socket = new SockJS(protocol + serverDomain + '/echo', null, { …
Alosyius
  • 8,771
  • 26
  • 76
  • 120
9
votes
5 answers

STOMP Spring WebSocket message exceeds size limit

I am implementing Spring WebSocket 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'…
Nikhil Das Nomula
  • 1,863
  • 5
  • 31
  • 50
9
votes
5 answers

How to set up an apache proxy for Meteor/SockJS and WebSocket?

I have an apache proxy for a meteor app and apache and meteor are on two separate machines. I need it that way as apache has to serve a lot of real websites and it wouldn't be a good idea to install the meteor app on this machine due to its limited…
Jey DWork
  • 1,746
  • 2
  • 16
  • 29
9
votes
1 answer

How to test node.js websocket server?

I'm using sockjs with standard configuration. var ws = sockjs.createServer(); ws.on('connection', function(conn) { conn.on('data', function(message) { wsParser.parse(conn, message) }); conn.on('close',…
kasztelan
  • 1,731
  • 3
  • 17
  • 24
8
votes
2 answers

"message:Broker not available." error when implementing stomp over spring websocket

I'm building a sample chat app using spring WebSocket, SockJs and Amazon MQ. It is throwing a 'broker not available' exception when the client subscribes to the topic. All the inbound traffic rules are set correctly in the AWS security groups, and…
Vishnu S Kumar
  • 666
  • 7
  • 24
8
votes
0 answers

Protocol compatibility problem with SockJS and Webstomp

I'm building webchat with Spring boot and Angular. To do this, I use Websockets with client-side SockJS and Webstomp, and server-side Spring. The problem is I obtain this error on the console in runtime : DEPRECATED: undefined is not a recognized…
mtnp
  • 314
  • 7
  • 24
8
votes
2 answers

SockJS fails to create/connect to Spring WebSocket

I am learning Spring WebSocket. I have successfully run this Spring WebSocket tutorial. Now I am trying to incorporate it as-is in my existing Spring MVC application. When I run it from Chrome browser, I see below error in its dev console. Chrome…
user890263
  • 159
  • 1
  • 3
  • 13
8
votes
1 answer

Websocket working on localhost but not Heroku

I have an application that uses websockets (STOMP over SockJs), with Spring at the backend. Application works fine (websockets) on localhost on Tomcat but when I deploy to Heroku or AWS Web Sockets stop working. My websocket configuration in…
Lukasz
  • 691
  • 1
  • 12
  • 30
8
votes
0 answers

WDS disconnected! constantly appear

Running webpack-dev-server is fine. First page load is ok. But when I refresh the browser, every 2 seconds 'WDS disconnected' appears in console and browser reload infinitely. This problem only appear in Firefox/Firefox Developer Edition browser.…
Yerkon
  • 4,548
  • 1
  • 18
  • 30
1 2
3
43 44