Structureswift-websocket 1.1.1WSClient
Context
Client implementation of WebSocketContext
.
struct Context
Client implementation of WebSocketContext
.
struct Context
import WSClient
struct WebSocketClient
WebSocket client
protocol WebSocketContext : Sendable
Protocol for WebSocket Data handling functions context parameter
init(url: String, configuration: WebSocketClientConfiguration = .init(), tlsConfiguration: TLSConfiguration? = nil, eventLoopGroup: EventLoopGroup = MultiThreadedEventLoopGroup.singleton, logger: Logger, handler: @escaping WebSocketDataHandler<Context>)
Initialize websocket client
@discardableResult static func connect(url: String, configuration: WebSocketClientConfiguration = .init(), tlsConfiguration: TLSConfiguration? = nil, eventLoopGroup: EventLoopGroup = MultiThreadedEventLoopGroup.singleton, logger: Logger, handler: @escaping WebSocketDataHandler<Context>) async throws -> WebSocketCloseFrame?
Create websocket client, connect and handle connection
@discardableResult func run() async throws -> WebSocketCloseFrame?
Connect and run handler
protocol Sendable
init(logger: Logger)
let logger: Logger