fix
This commit is contained in:
11
App.tsx
11
App.tsx
@@ -120,7 +120,6 @@ class Api {
|
|||||||
// 处理消息
|
// 处理消息
|
||||||
ws.onmessage = (event) => {
|
ws.onmessage = (event) => {
|
||||||
try {
|
try {
|
||||||
console.log('[WebSocket] 收到消息:', event.data);
|
|
||||||
const msg = JSON.parse(event.data);
|
const msg = JSON.parse(event.data);
|
||||||
|
|
||||||
// 处理响应消息
|
// 处理响应消息
|
||||||
@@ -159,7 +158,6 @@ class Api {
|
|||||||
},
|
},
|
||||||
// onError: TCP错误 → 通知服务器
|
// onError: TCP错误 → 通知服务器
|
||||||
(error: string) => {
|
(error: string) => {
|
||||||
console.error('[代理] TCP错误:', error);
|
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
type: 'proxyClose',
|
type: 'proxyClose',
|
||||||
messageId: msg.messageId
|
messageId: msg.messageId
|
||||||
@@ -167,15 +165,16 @@ class Api {
|
|||||||
}
|
}
|
||||||
).then(success => {
|
).then(success => {
|
||||||
if (success) {
|
if (success) {
|
||||||
// 回复就绪
|
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
type: 'proxyReady',
|
type: 'proxyReady',
|
||||||
messageId: msg.messageId
|
messageId: msg.messageId
|
||||||
}));
|
}));
|
||||||
console.log('[代理] TCP连接已建立');
|
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('[代理] 创建失败:', err);
|
ws.send(JSON.stringify({
|
||||||
|
type: 'proxyClose',
|
||||||
|
messageId: msg.messageId
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,14 +183,12 @@ class Api {
|
|||||||
if (TcpProxy && typeof TcpProxy.writeProxy === 'function') {
|
if (TcpProxy && typeof TcpProxy.writeProxy === 'function') {
|
||||||
TcpProxy.writeProxy(msg.messageId, msg.data.data).then(success => {
|
TcpProxy.writeProxy(msg.messageId, msg.data.data).then(success => {
|
||||||
if (!success) {
|
if (!success) {
|
||||||
// 写入失败,通知服务器关闭
|
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
type: 'proxyClose',
|
type: 'proxyClose',
|
||||||
messageId: msg.messageId
|
messageId: msg.messageId
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
console.error('[代理] 写入失败:', err);
|
|
||||||
ws.send(JSON.stringify({
|
ws.send(JSON.stringify({
|
||||||
type: 'proxyClose',
|
type: 'proxyClose',
|
||||||
messageId: msg.messageId
|
messageId: msg.messageId
|
||||||
|
|||||||
Submodule libs/rnwalletman updated: d9b6e8435f...00a0866c94
Reference in New Issue
Block a user