Interface WebSocketClient

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
DefaultHttpClient

public interface WebSocketClient extends AutoCloseable
Interface that provides a way to connect a client over WebSocket.
Since:
1.0
Author:
graemerocher
  • Field Details

  • 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 with ClientWebSocket
      request - The original request to establish the connection
      Returns:
      A Publisher that emits the ClientWebSocket instance
    • connect

      <T extends AutoCloseable> Publisher<T> connect(Class<T> clientEndpointType, Map<String,Object> parameters)
      Connect the given client endpoint type. Unlike connect(Class, URI) this method will the value declared within the ClientWebSocket as 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 with ClientWebSocket
      parameters - The URI parameters for the endpoint
      Returns:
      A Publisher that emits the ClientWebSocket instance
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • connect

      default <T extends AutoCloseable> Publisher<T> connect(Class<T> clientEndpointType, String uri)
      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 with ClientWebSocket
      uri - The URI to connect over
      Returns:
      A Publisher that emits the ClientWebSocket instance
    • connect

      default <T extends AutoCloseable> Publisher<T> connect(Class<T> clientEndpointType, URI uri)
      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 with ClientWebSocket
      uri - The URI to connect over
      Returns:
      A Publisher that emits the ClientWebSocket instance
    • create

      Deprecated.
      Use create(URI) instead
      Create a new WebSocketClient. Note that this method should only be used outside of the context of a Micronaut application. The returned WebSocketClient is not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application use Inject to inject a client instead.
      Parameters:
      url - The base URL
      Returns:
      The client
    • create

      Deprecated.
      Create a new WebSocketClient with the specified configuration. Note that this method should only be used outside of the context of an application. Within Micronaut use Inject to inject a client instead
      Parameters:
      url - The base URL
      configuration - the client configuration
      Returns:
      The client
      Since:
      2.2.0
    • create

      @NonNull static WebSocketClient create(@Nullable URI uri)
      Create a new WebSocketClient. Note that this method should only be used outside of the context of a Micronaut application. The returned WebSocketClient is not subject to dependency injection. The creator is responsible for closing the client to avoid leaking connections. Within a Micronaut application use Inject to inject a client instead.
      Parameters:
      uri - The base URI
      Returns:
      The client
      Since:
      3.2.0
    • create

      @NonNull static WebSocketClient create(@Nullable URI uri, HttpClientConfiguration configuration)
      Create a new WebSocketClient with the specified configuration. Note that this method should only be used outside of the context of an application. Within Micronaut use Inject to inject a client instead
      Parameters:
      uri - The base URI
      configuration - the client configuration
      Returns:
      The client
      Since:
      3.2.0