smuggledPancakes
smuggledPancakes

Reputation: 10323

Confused about how to make stomp calls with Spring-websockets

From 21.4.2 of the Spring documentation of WebSockets there is this explanation:

Or if connecting via WebSocket (without SockJS):

var socket = new WebSocket("/spring-websocket-portfolio/portfolio");

var stompClient = Stomp.over(socket);

stompClient.connect({}, function(frame) { }

I don't understand how we make a WebSocket connection without the usual ws://hostname:port/appName/...

Also, I cannot find any examples for connecting via a Java client using the Spring-websocket code. Is it possible?

Upvotes: 3

Views: 567

Answers (1)

smuggledPancakes
smuggledPancakes

Reputation: 10323

So it seems that there must be some special case where this works:

var socket = new WebSocket("/spring-websocket-portfolio/portfolio");

I ended up making the connection by using the path:

ws://localhost:8080/MyWebAppName/portfolio

Portfolio is the name of my stomp endpoint. I guess in this context of the documentation the hostname and port doesn't need to be specified.

Upvotes: 1

Related Questions