Package com.microsoft.azure.relay
Interface HybridConnectionChannel
- All Superinterfaces:
AutoCloseable,Channel,Closeable
- All Known Implementing Classes:
WebSocketChannel
-
Method Summary
Modifier and TypeMethodDescriptionCloses the connection with the remote websocketcloseAsync(javax.websocket.CloseReason reason) Closes the connection with the remote websocket with a given CloseReasonReceives byte messages from the remote sender asynchronously.Receives byte messages from the remote sender asynchronously within a given timeout.writeAsync(ByteBuffer data) Sends the data to the remote endpoint as binary.writeAsync(ByteBuffer data, Duration timeout) Sends the data to the remote endpoint within a timeout as binary.
-
Method Details
-
getTrackingContext
TrackingContext getTrackingContext() -
closeAsync
CompletableFuture<Void> closeAsync()Closes the connection with the remote websocket- Returns:
- Returns a CompletableFuture which completes when the connection is completely closed.
-
closeAsync
Closes the connection with the remote websocket with a given CloseReason- Parameters:
reason- The CloseReason to be given for this operation. For details please see javax.websocket.CloseReason.- Returns:
- Returns a CompletableFuture which completes when the connection is completely closed.
-
readAsync
CompletableFuture<ByteBuffer> readAsync()Receives byte messages from the remote sender asynchronously.- Returns:
- Returns a CompletableFuture of the bytes which completes when websocket receives the entire message.
-
readAsync
Receives byte messages from the remote sender asynchronously within a given timeout.- Parameters:
timeout- The timeout duration for this operation.- Returns:
- Returns a CompletableFuture of the bytes which completes when websocket receives the entire message.
-
writeAsync
Sends the data to the remote endpoint as binary.- Parameters:
data- Message to be sent.- Returns:
- A CompletableFuture which completes when websocket finishes sending the bytes.
-
writeAsync
Sends the data to the remote endpoint within a timeout as binary.- Parameters:
data- Message to be sent.timeout- The timeout to connect to send the data within. May be null to indicate no timeout limit.- Returns:
- A CompletableFuture which completes when websocket finishes sending the bytes.
-