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 ]

617 questions
440
votes
3 answers

Which websocket library to use with Node.js?

Currently there is a plethora of websocket libraries for node.js, the most popular seem to…
balupton
  • 42,415
  • 27
  • 116
  • 167
64
votes
4 answers

JSON Web Token (JWT) with Spring based SockJS / STOMP Web Socket

Background I am in the process of setting up a RESTful web application using Spring Boot (1.3.0.BUILD-SNAPSHOT) that includes a STOMP/SockJS WebSocket, which I intend to consume from an iOS app as well as web browsers. I want to use JSON Web Tokens…
Steve Wilford
  • 8,582
  • 5
  • 38
  • 66
49
votes
3 answers

Path variables in Spring WebSockets @SendTo mapping

I have, what I think to be, a very simple Spring WebSocket application. However, I'm trying to use path variables for the subscription as well as the message mapping. I've posted a paraphrased example below. I would expect the @SendTo annotation…
bvulaj
  • 4,568
  • 4
  • 27
  • 40
41
votes
4 answers

Header in the response must not be the wildcard '*' when the request's credentials mode is 'include'

I'm using Auth0 for my user authentication to only allow logged in users to access a Spring (Boot) RestController. At this point I'm creating a real-time message functionality where users can send messages from the Angular 2 client (localhost:4200)…
Sam
  • 1,153
  • 3
  • 16
  • 38
37
votes
1 answer

WebSocket with Sockjs & Spring 4 but without Stomp

Is there a way to use WebSockets with SockJS client and Spring 4 server but not using STOMP? Based on this tutorial from Spring's website, I know how to set up a WebSocket based application using Stomp and Spring 4. On the client side, we have: …
BlueChips23
  • 1,691
  • 3
  • 31
  • 49
35
votes
3 answers

Where "user" comes from in convertAndSendToUser works in SockJS+Spring Websocket?

I would like to understand how convertAndSendToUser works in Spring SockJS+Websocket framework. In client, we would connect as stompClient.connect(login, password, callback()) which will result in connect request with "Stomp credentials" of login…
Askar Ibragimov
  • 6,494
  • 15
  • 65
  • 132
35
votes
3 answers

Engine.io or SockJS, which one to choose?

I have run into trouble with Socket.io regarding memory leaks and scaling issues lately. My decision to use Socket.io was made over a year ago when it was undoubtedly the best library to use. Now that Socket.io causes much trouble, I spent time…
1nsane
  • 977
  • 1
  • 10
  • 20
35
votes
6 answers

How to unmarshal an escaped JSON string

I am using Sockjs with Go, but when the JavaScript client send json to the server it escapes it, and send's it as a []byte. I'm trying to figure out how to parse the json, so that i can read the data. but I get this error. json: cannot unmarshal…
Robin Westerlundh
  • 664
  • 1
  • 7
  • 12
29
votes
3 answers

Websocket in Spring Boot app - Getting 403 Forbidden

Websocket in Spring Boot app - Getting 403 Forbidden I can connect to the websocket from client using sockjs/stompjs when I run this in eclipse (no spring boot). But when I create a Spring boot jar(gradlew build) for the websocket code and run the…
user3755282
  • 563
  • 2
  • 6
  • 13
28
votes
4 answers

Spring WebSocket Connecting with SockJS to a different domain

WebSockets in Spring is a rather new topic that I;m tiring to find a bit more. My problem is with connecting to a service from a different domain, I'm working on with Lineman building the front-end side and Spring Boot when doing the back-end side,…
Sniady
  • 1,261
  • 1
  • 10
  • 17
25
votes
2 answers

How to send message to client through websocket using Spring

I try to use Spring with websocket. I started my investigation with this tutorial. In my side client I have something like that to initialize the connection to the server : function connect() { var socket = new SockJS('/myphotos/form'); …
cheb1k4
  • 1,920
  • 5
  • 21
  • 37
20
votes
3 answers

Sending images/files over Sockjs + Spring Websocket + Stomp

I am working on a messaging application using Spring websockets(STOMP as a sub-protocol) and Sockjs. I should provide support to send files in messages. According to this ticket, sockjs does not support binary data, but STOMP does. I know that we…
Karthik
  • 4,652
  • 4
  • 27
  • 62
18
votes
1 answer

Sending message to client periodically via Spring Web-Socket

I'm trying to make a connection between client and server via Spring webSocket and I'm doing this by the help of this link. I want Controller to send a "hello" to client every 5 seconds and client append it to the greeting box every time. This is…
ShakibaZar
  • 617
  • 2
  • 8
  • 23
17
votes
1 answer

Partial messages with SockJS in Spring-Websockets 4.2

I am using Spring-Websockets 4.2 with SockJS. Since the messages received by clients can be quite large, I would like to use partial messages. My subclass of TextWebSocketHandler does override supportsPartialMessages to return true. However, since…
Jan
  • 171
  • 6
16
votes
3 answers

WebSocket Stomp over SockJS - http custom headers

I'm using stomp.js over SockJS in my javascript client. I'm connecting to websocket using stompClient.connect({}, function (frame) { stomp over sockJS connection has 2 http requests: request to /info http upgrade request the client sends all…
user1116377
  • 511
  • 2
  • 10
  • 29
1
2 3
41 42