             fatalError("LiveChatManager methods called before properly initiated.")
         }
 
-        let params = [
-            "msg": "method",
-            "method": "login",
-            "params": [[
-                "resume": token
-            ]]
-        ] as [String : Any]
-        socketManager.send(params) { _ in
+        let params = ["resume": token] as [String : Any]
+        authManager.auth(params: params) { _ in
             self.loggedIn = true
             DispatchQueue.global(qos: .background).async(execute: completion)
         }

import Foundation
import RealmSwift

public class LiveChatManager: SocketManagerInjected {

    var injectionContainer: InjectionContainer!
    var initiated = false

            let json = response.result["result"]
            self.userId = json["userId"].stringValue
            self.token = json["token"].stringValue

            self.login {
                let roomSubscription = Subscription()
                roomSubscription.identifier = UUID().uuidString
                roomSubscription.rid = self.room
                roomSubscription.name = department.name
                Realm.execute({ realm in
                    realm.add(roomSubscription)
                })
