feat: 后端改为deno

This commit is contained in:
ethan.chen
2025-11-05 11:43:47 +08:00
parent ba3435e1a0
commit f67a3835fa
27 changed files with 1449 additions and 1404 deletions

View File

@@ -20,7 +20,7 @@ async function sendControlCommand(action, position = null) {
}
const response = await request({
url: '/control',
url: '/music/control',
method: 'POST',
data: payload
});

View File

@@ -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)) {