Chat SDK for React Native 1.14.0
    Preparing search index...

    Class ChatOptions

    聊天设置类,用于定义 SDK 的各种参数和选项,例如,是否发送前加密信息、是否自动接受加好友邀请等。

    Index

    Constructors

    • Parameters

      • params: {
            acceptInvitationAlways?: boolean;
            appId: string;
            appKey: string;
            areaCode?: ChatAreaCode;
            autoAcceptGroupInvitation?: boolean;
            autoLogin?: boolean;
            customDeviceName?: string;
            customOSType?: number;
            debugModel?: boolean;
            deleteMessagesAsExitChatRoom?: boolean;
            deleteMessagesAsExitGroup?: boolean;
            dnsUrl?: string;
            dohVendor?: number;
            enableDNSConfig?: boolean;
            enableEmptyConversation?: boolean;
            enableTLS?: boolean;
            imPort?: number;
            imServer?: string;
            isAutoDownload?: boolean;
            isChatRoomOwnerLeaveAllowed?: boolean;
            loginExtraInfo?: string;
            logTag?: string;
            logTimestamp?: boolean;
            messagesReceiveCallbackIncludeSend?: boolean;
            pushConfig?: ChatPushConfig;
            regardImportMessagesAsRead?: boolean;
            requireAck?: boolean;
            requireDeliveryAck?: boolean;
            restServer?: string;
            serverTransfer?: boolean;
            sortMessageByServerTime?: boolean;
            uikitVersion?: string;
            useReplacedMessageContents?: boolean;
            usingHttpsOnly?: boolean;
            webSocketPort?: number;
            webSocketServer?: string;
            workPathCopiable?: boolean;
        }

      Returns ChatOptions

      请使用 withAppId and withAppKey 替代.

    Properties

    acceptInvitationAlways: boolean

    是否自动接受好友邀请。

    • true: 是.
    • (Default) false: 否.
    appId: string

    创建 App 时在 console 后台上注册的 App 唯一识别符,即 App ID。

    appKey: string

    创建 App 时在 console 后台上注册的 App 唯一识别符,即 App Key。

    areaCode: ChatAreaCode

    区号。 该属性用于限制可访问边缘节点的范围。 默认值为“GLOB”。 请参阅ChatAreaCode。 该属性只有在调用 ChatClient.init 时才能设置。 在应用程序运行期间无法更改属性设置。

    autoAcceptGroupInvitation: boolean

    是否自动接受群组邀请。

    • (默认) true:是。
    • false:否。
    autoLogin: boolean

    是否开启自动登录。 -(默认) true:开启;

    • false:关闭。
    customDeviceName?: string

    自定义设备名称。

    customOSType 设置为 -1,则该属性不生效。

    典型应用:用户需要iphone手机和ipad设备同时在线。

    customOSType?: number

    自定义设备类型。

    debugModel: boolean

    是否输出调试信息。

    • true: SDK 会在日志里输出调试信息。
    • (默认) false: SDK 不输出调试信息。
    deleteMessagesAsExitChatRoom: boolean

    是否在退出(主动或被动)聊天室时删除该聊天室在内存和本地数据库中的历史消息。

    • (默认) true: 是;
    • false:否。
    deleteMessagesAsExitGroup: boolean

    是否在退出(主动或被动)群组时删除该群组中在内存和本地数据库中的历史消息。

    • (默认) true: 是;
    • false: 否。
    dnsUrl: string

    DNS 服务器的地址。

    dohVendor?: number

    DoH 供应商。

    0: 禁用 1: 中国 2: 全球

    该属性用于在 enableDNSConfigtrue 时指定 DoH 供应商。

    enableDNSConfig: boolean

    设置是否开启 DNS。

    • (默认) true:开启。
    • false:关闭。私有部署时需要关闭。
    enableEmptyConversation: boolean

    SDK 从本地数据库中加载会话时是否包含空会话(没有消息的会话):

    • true:包含空会话;
    • (默认)false:不包含空会话。
    enableTLS: boolean

    是否激活 TLS。默认false。

    imPort: number

    IM 消息服务器的自定义端口号。

    该端口在进行私有部署时实现数据隔离和数据安全时使用。

    如有需求,请联系商务。

    imServer: string

    IM 消息服务器地址。

    该地址在进行私有部署时实现数据隔离和数据安全时使用。

    如有需求,请联系商务。

    isAutoDownload: boolean

    是否自动下载缩略图。

    • (默认) true:是;
    • false:否。
    isChatRoomOwnerLeaveAllowed: boolean

    是否允许聊天室所有者离开聊天室。

    • (默认) true: 允许。离开聊天室后,聊天室所有者除了接收不到该聊天室的消息,其他权限不变。
    • false: 不允许。
    loginExtraInfo?: string

    是否在登录时传递额外的登录信息给服务器。

    该属性用于在登录时传递额外的登录信息给服务器,例如,登录时传递设备信息。

    logTag?: string

    日志可以带上的标记。区别其它类型的日志。

    logTimestamp?: boolean

    是否激活日志的时间戳。

    messagesReceiveCallbackIncludeSend: boolean

    接收消息通知是否包含发送成功的消息。

    • true:是。接收消息通知中包含发送成功的消息。
    • (默认)false:否。接收消息通知中只包含接收的消息。
    pushConfig?: ChatPushConfig

    推送设置。

    regardImportMessagesAsRead: boolean

    是否将导入的消息视为已读。

    requireAck: boolean

    是否需要接收方阅读消息后发送已读回执。

    • (默认) true:是;
    • false:否。

    该设置对于 ChatManager.sendConversationReadAck 无效。

    requireDeliveryAck: boolean

    是否需要接收方发送送达回执。 -(默认)true:是;

    • false:否。

    只对单聊有效。 ChatMessageChatType.PeerChat

    restServer: string

    REST 服务器地址。

    该地址在进行私有部署时实现数据隔离和数据安全时使用。

    如有需求,请联系商务。

    serverTransfer: boolean

    是否自动将消息附件上传到聊天服务器。 -(默认)true:是;

    • false:否。
    sortMessageByServerTime: boolean

    是否按服务器收到消息时间的倒序对消息排序。

    • (默认) true:是;
    • false:否。按消息创建时间的倒序排序。
    uikitVersion?: string

    UIKit 版本。

    • (Default) undefined.
    useReplacedMessageContents: boolean

    设置当发送的文本消息的内容被文本审核(Moderation)服务替换时,是否需要返回给发送方。

    • true:将内容替换后的消息返回给发送方。
    • (默认)false:将原消息返回给发送方。
    usingHttpsOnly: boolean

    是否只通过 HTTPS 进行 REST 操作。

    • (默认) true:是;
    • false:否。支持 HTTPS 和 HTTP。
    webSocketPort?: number

    WebSocket 服务器端口。

    该属性仅当 enableDnsConfigfalse 时有效。

    webSocketServer?: string

    WebSocket 服务器。

    该属性仅当 enableDnsConfigfalse 时有效。

    workPathCopiable?: boolean

    工作目录下的内容是否可以拷贝

    Note 仅ios平台生效。

    默认是 false

    Methods

    • Parameters

      • params: {
            acceptInvitationAlways?: boolean;
            appId: string;
            areaCode?: ChatAreaCode;
            autoAcceptGroupInvitation?: boolean;
            autoLogin?: boolean;
            customDeviceName?: string;
            customOSType?: number;
            debugModel?: boolean;
            deleteMessagesAsExitChatRoom?: boolean;
            deleteMessagesAsExitGroup?: boolean;
            dnsUrl?: string;
            dohVendor?: number;
            enableDNSConfig?: boolean;
            enableEmptyConversation?: boolean;
            enableTLS?: boolean;
            imPort?: number;
            imServer?: string;
            isAutoDownload?: boolean;
            isChatRoomOwnerLeaveAllowed?: boolean;
            loginExtraInfo?: string;
            logTag?: string;
            logTimestamp?: boolean;
            messagesReceiveCallbackIncludeSend?: boolean;
            pushConfig?: ChatPushConfig;
            regardImportMessagesAsRead?: boolean;
            requireAck?: boolean;
            requireDeliveryAck?: boolean;
            restServer?: string;
            serverTransfer?: boolean;
            sortMessageByServerTime?: boolean;
            uikitVersion?: string;
            useReplacedMessageContents?: boolean;
            usingHttpsOnly?: boolean;
            webSocketPort?: number;
            webSocketServer?: string;
            workPathCopiable?: boolean;
        }

      Returns ChatOptions

    • Parameters

      • params: {
            acceptInvitationAlways?: boolean;
            appKey: string;
            areaCode?: ChatAreaCode;
            autoAcceptGroupInvitation?: boolean;
            autoLogin?: boolean;
            customDeviceName?: string;
            customOSType?: number;
            debugModel?: boolean;
            deleteMessagesAsExitChatRoom?: boolean;
            deleteMessagesAsExitGroup?: boolean;
            dnsUrl?: string;
            dohVendor?: number;
            enableDNSConfig?: boolean;
            enableEmptyConversation?: boolean;
            enableTLS?: boolean;
            imPort?: number;
            imServer?: string;
            isAutoDownload?: boolean;
            isChatRoomOwnerLeaveAllowed?: boolean;
            loginExtraInfo?: string;
            logTag?: string;
            logTimestamp?: boolean;
            messagesReceiveCallbackIncludeSend?: boolean;
            pushConfig?: ChatPushConfig;
            regardImportMessagesAsRead?: boolean;
            requireAck?: boolean;
            requireDeliveryAck?: boolean;
            restServer?: string;
            serverTransfer?: boolean;
            sortMessageByServerTime?: boolean;
            uikitVersion?: string;
            useReplacedMessageContents?: boolean;
            usingHttpsOnly?: boolean;
            webSocketPort?: number;
            webSocketServer?: string;
            workPathCopiable?: boolean;
        }

      Returns ChatOptions