tidwall / SwiftWebSocket

Fast Websockets in Swift for iOS and OSX
MIT License
1.53k stars 246 forks source link

Minor doco updates? #85

Open smhk opened 7 years ago

smhk commented 7 years ago

This package is mind-blowing.

Two out of date items in the doco, hope it helps...

You must also add the libz.dylib library. Project -> Target -> Build Phases -> Link Binary With Libraries

I believe those are now ".tbd" files, no longer ".dylib"

the "Custom Headers" example code...

I believe that is now out of date with Swift. Latest would be...

let u = URL(string: "wss://foo.com/ws")!
let r = URLRequest(url: u)
r.setValue("foo", forHTTPHeaderField: "foo")
ws = WebSocket(request: r)

// example of using a cookie for authentication
let u = URL(string: "wss://foo.com/ws")!
let r = URLRequest(url: u)
r.setValue("cookieName=" + token, forHTTPHeaderField: "Cookie")
ws = WebSocket(request: r)

Hope it helps. Mind-blowing library. Incredible.