Swiftpack.co - viralplatipuss/WebsocketClientIO as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by viralplatipuss.
viralplatipuss/WebsocketClientIO 0.0.6
WebSocket Client IO Handler for SimpleFunctional
⭐️ 0
🕓 3 years ago
.package(url: "https://github.com/viralplatipuss/WebsocketClientIO.git", from: "0.0.6")

WebsocketClientIO

Websocket Client IO type and handler for use with the SimpleFunctional library.

Provides a very basic IO handler for establishing a websocket client. Will be extended as needed to handle more complex features.

This is powered using Vapor's WebSocketKit library, which means it is a multi-platform IO handler. Linux, Mac, iOS

struct WebSocketClientIO: IO {
    enum Input {
        enum SocketEvent {
            case didOpen
            case didClose
            case receivedBytes([UInt8])
            case didError(message: String)
        }
        
        case socketCreated(id: UInt, config: SocketConfig)
        case socketUpdated(id: UInt, event: SocketEvent)
    }
    
    enum Output {
        case createAndOpenSocket(config: SocketConfig)
        case closeSocket(id: UInt)
        case sendBytes(_ bytes: [UInt8], socketId: UInt)
    }
    
    struct SocketConfig {
        let hostname: String
        let port: Int?
        let authorizationHeader: String?
    }
}

GitHub

link
Stars: 0
Last commit: 3 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics