feat: 后端改为deno
This commit is contained in:
@@ -20,7 +20,7 @@ async function sendControlCommand(action, position = null) {
|
||||
}
|
||||
|
||||
const response = await request({
|
||||
url: '/control',
|
||||
url: '/music/control',
|
||||
method: 'POST',
|
||||
data: payload
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ import { ref } from 'vue';
|
||||
class WebSocketService {
|
||||
constructor() {
|
||||
this.socket = null;
|
||||
this.wsUrl = ref('ws://127.0.0.1:5000/ws');
|
||||
this.wsUrl = ref('ws://127.0.0.1:5005/ws');
|
||||
this.reconnectInterval = 1000; // 重连间隔(毫秒)
|
||||
this.reconnectTimer = null;
|
||||
this.pingInterval = null;
|
||||
@@ -178,6 +178,11 @@ class WebSocketService {
|
||||
try {
|
||||
const data = JSON.parse(event.data);
|
||||
console.log('收到WebSocket消息类型:', data.type);
|
||||
// 心跳:服务器发来的 ping,需要立即回复 pong 保持连接
|
||||
if (data && data.type === 'ping') {
|
||||
this.sendMessage({ type: 'pong' });
|
||||
return;
|
||||
}
|
||||
|
||||
// 调用对应类型的消息处理器
|
||||
if (data.type && this.messageHandlers.has(data.type)) {
|
||||
|
||||
Reference in New Issue
Block a user