SippoClient
This section explains how to create and register a SippoClient
First step needed is configure client with backend url
SippoClient.configure(with: SippoClient.Options(wacUrl: "https://www.example.com", fileSharingUrl: "https://www.example.com"))
At this point we need Sessions class to authenticate an User, we can use token, basic or anonymous authenticate method, and as response receives a task with a Bool or SippoClientError
SippoClient.client.sessions.connect(authentication: .basic(username: "username", password: "password")) { result in
switch result {
case .success:
print("Login successfully")
case let .failure(error):
print("Login failure: \(error)")
}
}
SippoClient.client.sessions.connect(authentication: .token(token: "aToken", provider: "aProvider")) { result in
switch result {
case .success:
print("Login successfully")
case let .failure(error):
print("Login failure: \(error)")
}
}
To receive state changes in SippoClient
we need to set a delegate ClientStateDelegate
class SippoStateDelegate: ClientStateDelegate {
func sippoClient(didChangeSippoState wacState: SippoServerState, didChangeStackState stackState: StackState) {
print("New state: \(wacState) \(stackState)")
}
}
let delegate = SippoStateDelegate()
SippoClient.client.delegate = delegate
To close SippoClient session send logout action with Auth class
SippoClient.client.sessions.disconnect { _ in
// Actions on disconnect
}
SippoClient.configure creates a new client accesible from SippoClient.client, but other clients still alive, so SippoClient.client.sessions.disconnect is required to clean a Session
Call SippoClient.client.sessions.connect is a must to access the other services (Invitations, Conferences..)