Chats

public class Chats

Service to manage chat actions and subscribe to chat events

  • Data needed to create each type of chat

    Declaration

    Swift

    public enum CreationType
  • Chats associated to active conferences

    Declaration

    Swift

    public var currentConferenceChats: [Chat] { get }

Delegates

Api

  • Starts a new chat session, new messages are delivered once it’s connected

    Declaration

    Swift

    public func connect(completion: @escaping () -> Void)

    Parameters

    completion

    completion block

  • Remove a chat session, this should be called on logout

    Declaration

    Swift

    public func disconnect(completion: @escaping () -> Void)

    Parameters

    completion

    completion block

  • Stops a chat session, this should be called when enters in background to receive pushes via apn

    Declaration

    Swift

    public func suspend(completion: @escaping () -> Void)

    Parameters

    completion

    completion block

  • Reconnects a chat session, this should be called when enters in foreground to receive pushes via socket tcp

    Declaration

    Swift

    public func reconnectSession(completion: @escaping () -> Void)

    Parameters

    completion

    completion block

  • Enable push module to receive new chat notifications

    Declaration

    Swift

    public func enablePushNotification(apnsToken: String,
                                       sessionToken: String,
                                       serverJID: String,
                                       completion: @escaping (Result<Void, ClientError>) -> Void)

    Parameters

    apnsToken

    APNS token

    sessionToken

    Token from sippo session

    serverJID

    Server to register the push

    completion

    completion block

  • Disable push module to stop receiving new chat notifications

    Declaration

    Swift

    public func disablePushNotification(sessionToken: String,
                                        serverJID: String,
                                        completion: @escaping (Result<Void, ClientError>) -> Void)

    Parameters

    sessionToken

    Token from sippo session

    serverJID

    Server to register the push

    completion

    completion block

  • Create a new chat

    Declaration

    Swift

    public func createChat(creationType: Chats.CreationType,
                           result: @escaping (Result<Chat, ResourceError>) -> Void)

    Parameters

    creationType

    Used to create a 1-1 chat or a group chat

    result

    Async result with Chat

  • Fetch chats

    Declaration

    Swift

    public func chats(types: [Chat.ChatType], result: @escaping (Result<[Chat], ResourceError>) -> Void)

    Parameters

    types

    Filter by type (1-1 or group)

    result

    Async result with a list of Chat