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://codercto.com/soft/d/3788.html

Using Google App Engine

Using Google App Engine

Charles Severance / O'Reilly Media / 2009-5-23 / USD 29.99

With this book, you can build exciting, scalable web applications quickly and confidently, using Google App Engine - even if you have little or no experience in programming or web development. App Eng......一起来看看 《Using Google App Engine》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

XML 在线格式化
XML 在线格式化

在线 XML 格式化压缩工具