Перейти к содержанию

CLASS

SSETransportDriver

public class SSETransportDriver: TransportDriver

Client-side HTTP(S) + SSE bidirectional transport

Used for communication with Spatium Signer Service. As soon as created, it immediately tries to connect to a provided url and start listening for incoming messages

  • SeeAlso TransportDriver

Properties

auth

public final let auth: AuthorizationSession

Methods

init(url:auth:)

public init(url: String, auth: AuthorizationSession)

Note

requests are attributed to accountId of an authorization session, thus storing data independently for each authorized user

Parameters

Name Description
url signer service endpoint (HTTP(S))
auth authorization AuthorizationSession session to use

send(meta:data:)

public func send(meta: TransportMeta, data: TransportData) async throws

Parameters

Name Description
meta message identifiers
data message data

connect(timeout:)

public func connect(timeout: UInt?) async throws

Connect and start listening to events

disconnect()

public func disconnect()

Stop listening for messages and disconnect

on(filter:callback:)

public func on(filter: TransportFilter, callback: @escaping TransportCallback) -> String

Parameters

Name Description
filter incoming message filter
callback to be invoked with messages matching to a provided filter

off(id:data:)

public func off(id: String, data: TransportData? = nil)

Parameters

Name Description
id subscription identifier returned upon creation
data (optional) message data to be sent to a current subscriber’s callback