準備聊天服務
要初始化聊天服務使用:
QBChatService.setDebugEnabled(真); //啟用聊天記錄
QBChatService.setDefaultPacketReplyTimeout(10000); //為連線資料包設定回覆超時(以毫秒為單位)。可用於登入,加入對話等事件,以便在網路較慢時增加伺服器的等待響應時間。
要配置聊天套接字,請使用 QBChatService.ConfigurationBuilder;
QBChatService.ConfigurationBuilder chatServiceConfigurationBuilder = new QBChatService.ConfigurationBuilder();
chatServiceConfigurationBuilder.setSocketTimeout(60); //Sets chat socket's read timeout in seconds
chatServiceConfigurationBuilder.setKeepAlive(true); //Sets connection socket's keepAlive option.
chatServiceConfigurationBuilder.setUseTls(true); //Sets the TLS security mode used when making the connection. By default TLS is disabled.
QBChatService.setConfigurationBuilder(chatServiceConfigurationBuilder);