|
|
@@ -63,8 +63,10 @@ impl AbstractWsMode {
|
|
|
|
|
|
// 如果不需要事先登录,则直接订阅消息
|
|
|
if !is_first_login {
|
|
|
- info!("订阅内容:{:?}", subscribe_array.clone());
|
|
|
+ info!("订阅长度: {}", subscribe_array.len());
|
|
|
for s in &subscribe_array {
|
|
|
+ info!("订阅内容:{} ", s);
|
|
|
+
|
|
|
let mut write_lock = ws_write_arc.lock().await;
|
|
|
write_lock.send(Message::Text(s.parse().unwrap())).await.expect("订阅消息失败");
|
|
|
}
|
|
|
@@ -207,7 +209,6 @@ impl AbstractWsMode {
|
|
|
//心跳包
|
|
|
pub async fn ping_or_pong(write_tx_clone: Arc<Mutex<UnboundedSender<Message>>>, h_type: HeartbeatType, millis: u64) {
|
|
|
loop {
|
|
|
- tokio::time::sleep(Duration::from_millis(millis)).await;
|
|
|
let write_tx_clone = write_tx_clone.lock().await;
|
|
|
write_tx_clone.unbounded_send(
|
|
|
match h_type {
|
|
|
@@ -223,6 +224,7 @@ impl AbstractWsMode {
|
|
|
}
|
|
|
).expect("发送失败");
|
|
|
trace!("发送指令-心跳:{:?}",h_type);
|
|
|
+ tokio::time::sleep(Duration::from_millis(millis)).await;
|
|
|
}
|
|
|
}
|
|
|
//数据解析
|
|
|
@@ -257,7 +259,7 @@ impl AbstractWsMode {
|
|
|
}
|
|
|
Err(e) => {
|
|
|
let message_str = format!("服务器响应:{:?}", e);
|
|
|
- trace!("{:?}",message_str);
|
|
|
+ error!("socket断连:{}", message_str);
|
|
|
Option::from(ResponseData::new("".to_string(), -1, message_str, Value::Null))
|
|
|
}
|
|
|
}
|