All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.whispersystems.signalservice.internal.websocket.WebSocketConnection.kt Maven / Gradle / Ivy

There is a newer version: 2.15.3_unofficial_107
Show newest version
package org.whispersystems.signalservice.internal.websocket

import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.core.Single
import org.whispersystems.signalservice.api.websocket.WebSocketConnectionState
import java.io.IOException
import java.util.Optional
import java.util.concurrent.TimeoutException

/**
 * Common interface for the web socket connection API
 *
 * At the time of this writing there are two implementations available:
 *  - OkHttpWebSocketConnection - the original Android client implementation in Java using OkHttp library
 *  - LibSignalChatConnection - the wrapper around libsignal's [org.signal.libsignal.net.ChatService]
 */
interface WebSocketConnection {
  val name: String

  fun connect(): Observable

  fun isDead(): Boolean

  fun disconnect()

  @Throws(IOException::class)
  fun sendRequest(request: WebSocketRequestMessage): Single

  @Throws(IOException::class)
  fun sendKeepAlive()

  fun readRequestIfAvailable(): Optional

  @Throws(TimeoutException::class, IOException::class)
  fun readRequest(timeoutMillis: Long): WebSocketRequestMessage

  @Throws(IOException::class)
  fun sendResponse(response: WebSocketResponseMessage?)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy