Package-level declarations

Websocket utility.

Connect to websocket.

To work with websocket use the following code example.

val networkManager: NetwrokManager
val webSocketManager: WebSocketManager = networkManager.webSocketManager

webSocketManager.connect(
useSSL = true, // Default true.
reconnectOnFailure = true, // Default true

// Groups of events that will arrive via the websocket.
// Some groups are used by other libraries.
// If you don't use some of them, just remove them from the set.
//
// The example shows the default list.
eventsGroups = setOf(
WebSocketEvent.Group.PHOTOS, // Used by Photo Library
WebSocketEvent.Group.FAMILY, // Used by Photo Library
WebSocketEvent.Group.FILES, // Used by Files Library
)
)

// ...

// Monitor websocket state
webSocketManager.stateFlow.collect { state ->
log.v("WS state updated - $state")
}

// ...

webSocketManager.disconnect()

To monitor websocket output use the following code example.

val networkManager: NetwrokManager
val webSocketManager: WebSocketManager = networkManager.webSocketManager

webSocketManager.eventFlow.collect { eventList ->
// do something...
}

Thread a gives a list of events. Each event represents the following data structure.

data class WebSocketEvent(

// Event type
val type: Type,

// Event group
val group: Group,

// JSON event representation
val json: JSONObject,
)

Full information about JSON event representation can be found here.

Types

Link copied to clipboard
data class WebSocketEvent(val type: WebSocketEvent.Type, val group: WebSocketEvent.Group, val timestamp: Long, val json: JSONObject)

Web socket event representation.

Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard