Package io.micronaut.websocket
Interface WebSocketClient
- All Superinterfaces:
 AutoCloseable
- All Known Implementing Classes:
 DefaultHttpClient
Interface that provides a way to connect a client over WebSocket.
- Since:
 - 1.0
 - Author:
 - graemerocher
 
- 
Field Summary
Fields - 
Method Summary
Modifier and TypeMethodDescriptionvoidclose()<T extends AutoCloseable>
Publisher<T>connect(Class<T> clientEndpointType, MutableHttpRequest<?> request) Connect the given client endpoint type to the URI over WebSocket.default <T extends AutoCloseable>
Publisher<T>Connect the given client endpoint type to the URI over WebSocket.default <T extends AutoCloseable>
Publisher<T>Connect the given client endpoint type to the URI over WebSocket.<T extends AutoCloseable>
Publisher<T>Connect the given client endpoint type.static @NonNull WebSocketClientCreate a newWebSocketClient.static @NonNull WebSocketClientcreate(@Nullable URI uri, HttpClientConfiguration configuration) Create a newWebSocketClientwith the specified configuration.static @NonNull WebSocketClientDeprecated.static @NonNull WebSocketClientcreate(@Nullable URL url, HttpClientConfiguration configuration) Deprecated.Usecreate(URI, HttpClientConfiguration)instead 
- 
Field Details
- 
SCHEME_WS
Constant for HTTP scheme.- See Also:
 
 - 
SCHEME_WSS
Constant for HTTPS scheme.- See Also:
 
 
 - 
 - 
Method Details
- 
connect
<T extends AutoCloseable> Publisher<T> connect(Class<T> clientEndpointType, MutableHttpRequest<?> request) Connect the given client endpoint type to the URI over WebSocket.- Type Parameters:
 T- The generic type- Parameters:
 clientEndpointType- The endpoint type. Should be a class annotated withClientWebSocketrequest- The original request to establish the connection- Returns:
 - A 
Publisherthat emits theClientWebSocketinstance 
 - 
connect
<T extends AutoCloseable> Publisher<T> connect(Class<T> clientEndpointType, Map<String, Object> parameters) Connect the given client endpoint type. Unlikeconnect(Class, URI)this method will the value declared within theClientWebSocketas the URI and expand the URI with the given parameters.- Type Parameters:
 T- The generic type- Parameters:
 clientEndpointType- The endpoint type. Should be a class annotated withClientWebSocketparameters- The URI parameters for the endpoint- Returns:
 - A 
Publisherthat emits theClientWebSocketinstance 
 - 
close
void close()- Specified by:
 closein interfaceAutoCloseable
 - 
connect
Connect the given client endpoint type to the URI over WebSocket.- Type Parameters:
 T- The generic type- Parameters:
 clientEndpointType- The endpoint type. Should be a class annotated withClientWebSocketuri- The URI to connect over- Returns:
 - A 
Publisherthat emits theClientWebSocketinstance 
 - 
connect
Connect the given client endpoint type to the URI over WebSocket.- Type Parameters:
 T- The generic type- Parameters:
 clientEndpointType- The endpoint type. Should be a class annotated withClientWebSocketuri- The URI to connect over- Returns:
 - A 
Publisherthat emits theClientWebSocketinstance 
 - 
create
Deprecated.Usecreate(URI)insteadCreate a newWebSocketClient. Note that this method should only be used outside the context of a Micronaut application. The returnedWebSocketClientis not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application useInjectto inject a client instead.- Parameters:
 url- The base URL- Returns:
 - The client
 
 - 
create
@Deprecated @NonNull static @NonNull WebSocketClient create(@Nullable @Nullable URL url, HttpClientConfiguration configuration) Deprecated.Usecreate(URI, HttpClientConfiguration)insteadCreate a newWebSocketClientwith the specified configuration. Note that this method should only be used outside the context of an application. Within Micronaut useInjectto inject a client instead- Parameters:
 url- The base URLconfiguration- the client configuration- Returns:
 - The client
 - Since:
 - 2.2.0
 
 - 
create
Create a newWebSocketClient. Note that this method should only be used outside the context of a Micronaut application. The returnedWebSocketClientis not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application useInjectto inject a client instead.- Parameters:
 uri- The base URI- Returns:
 - The client
 - Since:
 - 3.2.0
 
 - 
create
@NonNull static @NonNull WebSocketClient create(@Nullable @Nullable URI uri, HttpClientConfiguration configuration) Create a newWebSocketClientwith the specified configuration. Note that this method should only be used outside the context of an application. Within Micronaut useInjectto inject a client instead- Parameters:
 uri- The base URIconfiguration- the client configuration- Returns:
 - The client
 - Since:
 - 3.2.0
 
 
 - 
 
create(URI)instead