准备聊天服务
要初始化聊天服务使用:
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);