spring-framework / org.springframework.web.socket.messaging / WebSocketStompClient / connect

connect

open fun connect(url: String, handler: StompSessionHandler, vararg uriVars: Any): ListenableFuture<StompSession>

Connect to the given WebSocket URL and notify the given org.springframework.messaging.simp.stomp.StompSessionHandler when connected on the STOMP level after the CONNECTED frame is received.

Parameters

url - the url to connect to

handler - the session handler

uriVars - URI variables to expand into the URL

Return
ListenableFuture for access to the session when ready for use

open fun connect(url: String, @Nullable handshakeHeaders: WebSocketHttpHeaders, handler: StompSessionHandler, vararg uriVariables: Any): ListenableFuture<StompSession>

An overloaded version of #connect(String, StompSessionHandler, Object...) that also accepts WebSocketHttpHeaders to use for the WebSocket handshake.

Parameters

url - the url to connect to

handshakeHeaders - the headers for the WebSocket handshake

handler - the session handler

uriVariables - URI variables to expand into the URL

Return
ListenableFuture for access to the session when ready for use

open fun connect(url: String, @Nullable handshakeHeaders: WebSocketHttpHeaders, @Nullable connectHeaders: StompHeaders, handler: StompSessionHandler, vararg uriVariables: Any): ListenableFuture<StompSession>

An overloaded version of #connect(String, StompSessionHandler, Object...) that also accepts WebSocketHttpHeaders to use for the WebSocket handshake and StompHeaders for the STOMP CONNECT frame.

Parameters

url - the url to connect to

handshakeHeaders - headers for the WebSocket handshake

connectHeaders - headers for the STOMP CONNECT frame

handler - the session handler

uriVariables - URI variables to expand into the URL

Return
ListenableFuture for access to the session when ready for use

open fun connect(url: URI, @Nullable handshakeHeaders: WebSocketHttpHeaders, @Nullable connectHeaders: StompHeaders, sessionHandler: StompSessionHandler): ListenableFuture<StompSession>

An overloaded version of #connect(String, WebSocketHttpHeaders, StompSessionHandler, Object...) that accepts a fully prepared java.net.URI.

Parameters

url - the url to connect to

handshakeHeaders - the headers for the WebSocket handshake

connectHeaders - headers for the STOMP CONNECT frame

sessionHandler - the STOMP session handler

Return
ListenableFuture for access to the session when ready for use