Confused about how to make point calls with Spring-websockets

From 21.4.2 Spring documentation for WebSockets there is the following explanation:

Or when connecting via WebSocket (no SockJS):

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

var stompClient = Stomp.over(socket);

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

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

Also, I can't find examples for connecting via Java client using Spring-websocket code. Is it possible?

+3


source to share


1 answer


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

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

      

I ended up creating a connection using the path:



ws://localhost:8080/MyWebAppName/portfolio

      

Portfolio is the name of my top endpoint. My guess is that in this context of documentation, the hostname and port do not need to be specified.

+1


source







All Articles