no message

This commit is contained in:
kuaifan 2024-12-12 12:54:50 +08:00
parent 69ec4966d5
commit a032c6114f
4 changed files with 18 additions and 5 deletions

View File

@ -103,6 +103,10 @@ class WebSocketService implements WebSocketHandlerInterface
case 'receipt': case 'receipt':
return; return;
// 握手信息
case 'handshake':
break;
// 访问状态 // 访问状态
case 'path': case 'path':
$row = WebSocket::whereFd($frame->fd)->first(); $row = WebSocket::whereFd($frame->fd)->first();

View File

@ -167,7 +167,7 @@ services:
ai: ai:
container_name: "dootask-ai-${APP_ID}" container_name: "dootask-ai-${APP_ID}"
image: "kuaifan/dootask-ai:0.2.0" image: "kuaifan/dootask-ai:0.2.2"
environment: environment:
REDIS_HOST: "${REDIS_HOST}" REDIS_HOST: "${REDIS_HOST}"
REDIS_PORT: "${REDIS_PORT}" REDIS_PORT: "${REDIS_PORT}"

View File

@ -179,10 +179,19 @@ export default {
$A.updateTimezone() $A.updateTimezone()
this.__windowTimer && clearTimeout(this.__windowTimer) this.__windowTimer && clearTimeout(this.__windowTimer)
this.__timeoutTimer && clearTimeout(this.__timeoutTimer)
this.__windowTimer = setTimeout(async () => { this.__windowTimer = setTimeout(async () => {
try { try {
await this.$store.dispatch("call", {url: "users/socket/status"}) await this.$store.dispatch("call", {url: "users/socket/status"})
await this.$store.dispatch("websocketSend", {type: 'handshake'}) await new Promise((resolve, reject) => {
this.$store.dispatch("websocketSend", {
type: 'handshake',
callback: (_, ok) => {
ok ? resolve() : reject(new Error('Handshake failed'));
}
});
this.__timeoutTimer = setTimeout(() => reject(new Error('Handshake timeout')), 6000);
});
} catch { } catch {
await this.$store.dispatch("websocketConnection") await this.$store.dispatch("websocketConnection")
} }

View File

@ -4030,7 +4030,7 @@ export default {
return return
} }
if (typeof callback === "function") { if (typeof callback === "function") {
msgId = $A.randomString(16) msgId = type + '_' + $A.randomString(3)
state.wsCall[msgId] = callback state.wsCall[msgId] = callback
} }
try { try {