diff --git a/docs/12to13.html b/docs/12to13.html index 85b45e5..ccf8495 100644 --- a/docs/12to13.html +++ b/docs/12to13.html @@ -186,8 +186,8 @@ the swift client now only uses one engine per connection. Previously in order to to create multiple clients, and each client had its own engine.
Some v12 code might’ve looked like this:
-let defaultSocket = SocketIOClient(socketURL: myURL)
-let namespaceSocket = SocketIOClient(socketURL: myURL, config: [.nsp("/swift")])
+let defaultSocket = SocketIOClient(socketURL: myURL)
+let namespaceSocket = SocketIOClient(socketURL: myURL, config: [.nsp("/swift")])
// add handlers for sockets and connect
@@ -196,7 +196,7 @@ to create multiple clients, and each client had its own engine.
In v12 this would have opened two connections to the socket.io.
In v13 the same code would look like this:
-let manager = SocketManager(socketURL: myURL)
+let manager = SocketManager(socketURL: myURL)
let defaultSocket = manager.defaultSocket
let namespaceSocket = manager.socket(forNamespace: "/swift")
@@ -227,9 +227,9 @@ associated with that namespace.
You should know that SocketIOClients no longer need to be held around in properties, but the SocketManager should.
One of the most common mistakes people made is not maintaining a strong reference to the client.
-class Manager {
+class Manager {
func addHandlers() {
- let socket = SocketIOClient(socketURL: myURL, config: [.nsp("/swift")])
+ let socket = SocketIOClient(socketURL: myURL, config: [.nsp("/swift")])
// Add handlers
}
@@ -239,8 +239,8 @@ associated with that namespace.
This would have resulted in the client being released and no handlers being called.
A correct equivalent would be:
-class Manager {
- let socketManager = SocketManager(socketURL: someURL)
+class Manager {
+ let socketManager = SocketManager(socketURL: someURL)
func addHandlers() {
let socket = socketManager.socket(forNamespace: "/swift")
@@ -274,8 +274,8 @@ and a connect event fired.