- All Known Implementing Classes:
Httpd
- Enclosing interface:
WebSocket
public static interface WebSocket.Factory
A factory for creating WebSockets.
-
Method Summary
Modifier and TypeMethodDescriptionnewWebSocket(Request request, WebSocketListener listener) Creates a new web socket and immediately returns it.
-
Method Details
-
newWebSocket
Creates a new web socket and immediately returns it. Creating a web socket initiates an asynchronous process to connect the socket. Once the socket is successfully connected or fails to connect, thelistenerwill be notified. The caller must either close or cancel the returned web socket when it is no longer in use.- Parameters:
request- The HTTP request to upgrade to a WebSocket.listener- The listener to receive events for this WebSocket.- Returns:
- The new WebSocket.
-