WebSocket 客户端库 SwiftWebSocket

码农软件 · 软件分类 · WebSocket开发包 · 2019-04-17 15:59:28

软件介绍

SwiftWebSocket 是高性能的 WebSocket 客户端库。

特性:

  • 纯 Swift 解决方案,无需Objective-C的桥接。

  • 读取压缩消息 (permessage-deflate). IETF Draft

  • 严格UTF-8处理。

  • API 模仿 Javascript API.

  • 支持 TLS / WSS .

  • binaryType 属性在 [UInt8] 或 NSData 消息之间选择。

  • 零判断。所有的联网、流、协议错误,都通过 error 事件路径发送。

  • 发送 pings 和接受 pong 事件。

  • 高性能。

例子:

func echoTest(){
    var messageNum = 1
    var ws = WebSocket(url: "wss://echo.websocket.org")
    var send : ()->() = {
        var msg = "#\(messageNum++): \(NSDate().description)"
        println("send: \(msg)")
        ws.send(msg)
    }
    ws.event.open = {
        println("opened")
        send()
    }
    ws.event.close = { (code, reason, clean) in
        println("close")
    }
    ws.event.error = { (error) in
        println("error \(error.localizedDescription)")
    }
    ws.event.message = { (message) in
        if let text = message as? String {
            println("recv: \(text)")
            send()
        }
    }
}

本文地址:https://www.codercto.com/soft/d/3788.html

The Golden Ticket

The Golden Ticket

Lance Fortnow / Princeton University Press / 2013-3-31 / USD 26.95

The P-NP problem is the most important open problem in computer science, if not all of mathematics. The Golden Ticket provides a nontechnical introduction to P-NP, its rich history, and its algorithmi......一起来看看 《The Golden Ticket》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具