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
452
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
  • 47,113
  • 32
  • 131
  • 182
74
votes
5 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,894
  • 5
  • 42
  • 66
61
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
  • 5,023
  • 5
  • 31
  • 45
50
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
  • 834
  • 1
  • 8
  • 12
49
votes
5 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,303
  • 3
  • 23
  • 41
45
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…
onkami
  • 8,791
  • 17
  • 90
  • 176
41
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,861
  • 5
  • 34
  • 53
35
votes
4 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
  • 813
  • 2
  • 9
  • 15
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
  • 1,017
  • 2
  • 12
  • 21
34
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,633
  • 1
  • 12
  • 21
33
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
  • 2,316
  • 7
  • 26
  • 39
24
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
  • 241
  • 2
  • 6
21
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
  • 727
  • 3
  • 9
  • 27
21
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,950
  • 6
  • 35
  • 65
19
votes
3 answers

Difference between /topic, /queue for SimpleMessageBroker in Spring Websocket + SockJS

Is there a clarification, what is the differences between /topic, /queue etc. for Spring Websocket + SockJS in case I am using "simple broker" ? E.g. here Sending message to specific user on Spring Websocket it is said: when your client subscribe…
onkami
  • 8,791
  • 17
  • 90
  • 176
1
2 3
43 44