when do sockjs fallback to xhr streaming transport instead of websocket - websocket

I have a simple web app, which is using websockets.
simple webapp:
Frontend - using sockjs, stomp
Backend - Spring 4.2.x
Frontend & Backend are packaged in the same WAR, this WAR is deployed on IBM WebSphere Application Server v9.x
When I check the Developer Tools/Web Console in chrome(61.x)/firefox(56.0, 32 bit), I see that websocket transport is not being used, it's always xhr streaming. To use the websocket transport, I have passed the transports option in sockjs, like below, but after this change the websockets stopped working.
var sockjs = new SockJS(my url, null, {transports: ["websocket"]});
Do we need to change any configuration on IBM WebSphere Application Server v9.x to enable websocket transport ?
Update: on tomcat/liberty servers, sample app always uses websocket transport. Only on WAS, it is using xhr streaming. Issue in WAS?

Websocket protocol handling is on by default for Websphere v9.x

Related

Building realtime messaging app with websockets in spring boot

I want to build a messaging backend service (similar to whatsapp) using spring boot and websockets.
I have look online at the examples of spring boot websockets.
I see how I would send a message to the server from client 1 using the #MessageMapping annotation.
However assuming client 2 (recipient of the message) is also connected to the server with websockets how would I send a message to them.
I have seen the sendToUser annotation however it seems to me that that sends the message to client 1 (the sender of the message).
Is there a map of client ids to websocket sessions or something so that if I know the message should go to (client 2). I can gethis active websocket session and then send him the message?

Is there a way to use spring message brokers without Stompendpoints?

We have a use case to create websocket server. Mobile clients will connect to this websocket server. However mobile clients doesn't support stomp.
We would like to create a Java websocket server. spring does support websockets but it's heavily coupled with STOMP. we like to use Spring message broker concept here but because of Stomp, we are struck now. Is there anyway to overcome this and enable Spring websocket without STOMP but with Spring message broker concept?

Spring boot + Spring Integration Websocket adapter + Tibco JMS Server

I am working to build an application (Server side) which should pick message from tibco jms queue and then post that to a url at which the Client (written in angular js) will listen, and also from client when some actions are taken then the server should listen to those actions and perform respective actions.
I can read from tibco jms queue and can place it to a spring integration channel.
My question here is that, can this be build using spring integration websocket adaptors (inbound & outbound) ? If yes then can someone help me with some references for sending to the client and receiving from the client adaptor configurations ?
All the info about Spring Integration Websocket module is in the Reference Manual.
You also can take a look to a couple samples:
Simple plain Websockets
Chat based on STOMP protocol

Any websocket error codes simulator available to test java websocket client for different websocket errors that can come

I have a STOMP over websocket client server implementation. I want to test my java websocket client implemented using javax websocket on eclipse jetty for different websocket errors that can come. Is there a websocket simulator that can send different websocket error codes that I wish to test ?
My websocket server is implemented using spring websockets.

Spring 4 websocket + stomp + rabbitmq and clustering

I am going through Spring 4 websocket + stomp + rabbitmq(RabbitMQ-Web-Stomp plugin) architecture and I have a question about clustering. As per my understanding here Spring MVC act as a gateway for STOMP requests. If we cluster the application instance with spring web socket configuration will it create any confusion? For an example will it open multiple listeners and how will in such a case this architecture behave?
In this scenario, you would need to use load balancing and a message broker. I used HAProxy to load balance 4 Spring MVC instances (websocket) running on 4 tomcat servers. Also configure rabbit mq as a broker. From client code connect to the single HAProxy url.
If you don't use the message broker, then the websocket client subscriptions will be maintained in the app/ web server's (tomcat) JVM and in case one instance goes down, all the subscriptions on that would be lost.

Resources