feat: 更新 RemoteApp 类以支持 token 和 app ID,增强 WebSocket URL 生成逻辑;添加 ws-app 测试文件
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { logger } from '@/module/logger.ts';
|
||||
import { assistantConfig, app } from '../app.ts';
|
||||
import { WebSocket } from 'ws';
|
||||
import '../routes/index.ts';
|
||||
import { RemoteApp } from '@/module/assistant/remote-app/remote-app.ts';
|
||||
const main = async () => {
|
||||
@@ -17,4 +18,5 @@ const main = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
main();
|
||||
// main();
|
||||
|
||||
|
||||
35
assistant/src/test/ws-app.ts
Normal file
35
assistant/src/test/ws-app.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { WebSocket } from 'ws';
|
||||
|
||||
const testRouter = () => {
|
||||
// const ws = new WebSocket('ws://121.4.112.18:3005/api/router');
|
||||
// const ws = new WebSocket('wss://kevisual.xiongxiao.me/ws/proxy');
|
||||
// const ws = new WebSocket('wss://kevisual.xiongxiao.me/api/router');
|
||||
|
||||
const ws = new WebSocket('ws://118.196.32.29:3005/api/router');
|
||||
// const ws = new WebSocket('wss://kevisual.cn/api/router');
|
||||
console.log('Connecting to WebSocket server...');
|
||||
ws.on('open', () => {
|
||||
console.log('WebSocket connection opened');
|
||||
ws.send(
|
||||
JSON.stringify({
|
||||
"type": "router",
|
||||
"data": {
|
||||
path: 'system',
|
||||
key: 'version'
|
||||
}
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
ws.on('message', (data) => {
|
||||
console.log('Received message from server:', data.toString());
|
||||
});
|
||||
ws.on('close', () => {
|
||||
console.log('WebSocket connection closed');
|
||||
});
|
||||
ws.on('error', (error) => {
|
||||
console.error('WebSocket error:', error);
|
||||
});
|
||||
}
|
||||
|
||||
testRouter()
|
||||
Reference in New Issue
Block a user