-
- All Implemented Interfaces:
-
io.getstream.android.core.api.subscribe.StreamObservable,io.getstream.android.core.api.subscribe.StreamSubscriptionManager
public interface StreamWebSocket<T extends StreamWebSocketListener> implements StreamSubscriptionManager<T>
Represents a WebSocket connection used for real-time communication with the Stream API.
Implementations of this interface manage the lifecycle of a socket connection, handle sending messages, and provide subscription management for socket events.
-
-
Method Summary
Modifier and Type Method Description abstract Result<Unit>open(StreamSocketConfig config)Opens the WebSocket connection using the provided configuration. abstract Result<Unit>close(Integer code, String reason)Closes the WebSocket connection with a custom code and reason. abstract Result<ByteArray>send(ByteArray data)Sends binary data through the WebSocket connection. abstract Result<String>send(String text)Sends a text message through the WebSocket connection. -
Methods inherited from class io.getstream.android.core.api.socket.StreamWebSocket
clear, forEach -
Methods inherited from class io.getstream.android.core.api.subscribe.StreamSubscriptionManager
subscribe -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
open
abstract Result<Unit> open(StreamSocketConfig config)
Opens the WebSocket connection using the provided configuration.
- Parameters:
config- The StreamSocketConfig defining connection parameters such as endpoint, authentication, and optional headers.
-
close
abstract Result<Unit> close(Integer code, String reason)
Closes the WebSocket connection with a custom code and reason.
- Parameters:
code- The closure status codereason- The reason message provided by the peer, if any.
-
send
abstract Result<ByteArray> send(ByteArray data)
Sends binary data through the WebSocket connection.
- Parameters:
data- The raw bytes to be sent.
-
-
-
-