0.7.0-rc1
版本发布时间: 2018-02-12 22:54:48
davidstump/SwiftPhoenixClient最新发布版本:5.3.3(2024-07-30 21:22:10)
This release introduces breaking changes from 0.6.0
The Wiki for more details
Initialization
- The init method no longer requires breaking up an endpoint.
init(domainAndPort:, path:, transport:, prot:, params)
as been removed in favor ofinit(url:, params:) where
url:can be a String or a URL and params is an optional
[String:Any]` - The socket no longer opens automatically upon initialization. You must call
.open()
in order to open the socket connection to the endpoint..open()
can be called before or after channels are joined
Channels
- the
.join()
method signature has changed. It now accepts an optionalPayload
parameters to send when joining a channel. - The closure passed to the socket when joining a channel now returns a
Channel
instead ofAny
so you no longer need to force castlet channel = channel as! Channel
- Listening to an event on a channel has changes slightly. The handler now returns the
payload
of a phoenix message so you can access values as such:
let status = payload["status"]
print(status) // "ok"
Sending Messages
You can now send a message through the socket or to a topic through a channel. You can receive events on a successful or failed send. See the wiki for more details
Removed
- The
Message
object has been removed and replaced withPayload
which is just atypealias
of[String:Any