Package org.openhab.core.io.net.http
Interface WebSocketFactory
@NonNullByDefault
public interface WebSocketFactory
Factory class to create Jetty web socket clients
- Author:
- Kai Kreuzer - Initial contribution
-
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.jetty.websocket.client.WebSocketClient
createWebSocketClient
(String consumerName) Creates a new Jetty web socket client.org.eclipse.jetty.websocket.client.WebSocketClient
createWebSocketClient
(String consumerName, @Nullable org.eclipse.jetty.util.ssl.SslContextFactory sslContextFactory) Creates a new Jetty web socket client.org.eclipse.jetty.websocket.client.WebSocketClient
Returns a shared Jetty web socket client.
-
Method Details
-
createWebSocketClient
Creates a new Jetty web socket client. The returned client is not started yet. You have to start it yourself before using. Don't forget to stop a started client again after its usage. The client lifecycle should be the same as for your service. DO NOT CREATE NEW CLIENTS FOR EACH REQUEST!- Parameters:
consumerName
- the for identifying the consumer in the Jetty thread pool. Must be between 4 and 20 characters long and must contain only the following characters [a-zA-Z0-9-_]- Returns:
- the Jetty client
- Throws:
NullPointerException
- ifconsumerName
isnull
IllegalArgumentException
- ifconsumerName
is invalid
-
createWebSocketClient
org.eclipse.jetty.websocket.client.WebSocketClient createWebSocketClient(String consumerName, @Nullable org.eclipse.jetty.util.ssl.SslContextFactory sslContextFactory) Creates a new Jetty web socket client. The returned client is not started yet. You have to start it yourself before using. Don't forget to stop a started client again after its usage. The client lifecycle should be the same as for your service. DO NOT CREATE NEW CLIENTS FOR EACH REQUEST!- Parameters:
consumerName
- the for identifying the consumer in the Jetty thread pool. Must be between 4 and 20 characters long and must contain only the following characters [a-zA-Z0-9-_]sslContextFactory
- the SSL factory managing TLS encryption- Returns:
- the Jetty client
- Throws:
NullPointerException
- ifconsumerName
isnull
IllegalArgumentException
- ifconsumerName
is invalid
-
getCommonWebSocketClient
org.eclipse.jetty.websocket.client.WebSocketClient getCommonWebSocketClient()Returns a shared Jetty web socket client. You must not call any setter methods orstop()
on it. The returned client is already started.- Returns:
- a shared Jetty web socket client
-