mirror of
https://github.com/LLOneBot/LLOneBot.git
synced 2024-11-22 01:56:33 +00:00
perf: log long string
This commit is contained in:
parent
e4508ea5c7
commit
ebea755731
@ -35,10 +35,10 @@ export class ReverseWebsocket {
|
||||
public async onmessage(msg: string) {
|
||||
let receiveData: { action: ActionName, params: any, echo?: string } = {action: null, params: {}}
|
||||
let echo = ""
|
||||
log("收到反向Websocket消息", msg)
|
||||
try {
|
||||
receiveData = JSON.parse(msg.toString())
|
||||
echo = receiveData.echo
|
||||
log("收到反向Websocket消息", receiveData)
|
||||
} catch (e) {
|
||||
return wsReply(this.websocket, OB11Response.error("json解析失败,请检查数据格式", 1400, echo))
|
||||
}
|
||||
@ -89,18 +89,18 @@ export class ReverseWebsocket {
|
||||
log("Trying to connect to the websocket server: " + this.url);
|
||||
|
||||
|
||||
this.websocket.on("open", ()=> {
|
||||
this.websocket.on("open", () => {
|
||||
log("Connected to the websocket server: " + this.url);
|
||||
this.onopen();
|
||||
});
|
||||
|
||||
this.websocket.on("message", async (data)=>{
|
||||
this.websocket.on("message", async (data) => {
|
||||
await this.onmessage(data.toString());
|
||||
});
|
||||
|
||||
this.websocket.on("error", log);
|
||||
|
||||
this.websocket.on("close", ()=> {
|
||||
this.websocket.on("close", () => {
|
||||
log("The websocket connection: " + this.url + " closed, trying reconnecting...");
|
||||
this.onclose();
|
||||
});
|
||||
|
@ -36,10 +36,10 @@ class OB11WebsocketServer extends WebsocketServerBase {
|
||||
wsClient.on("message", async (msg) => {
|
||||
let receiveData: { action: ActionName, params: any, echo?: string } = {action: null, params: {}}
|
||||
let echo = ""
|
||||
log("收到正向Websocket消息", msg)
|
||||
try {
|
||||
receiveData = JSON.parse(msg.toString())
|
||||
echo = receiveData.echo
|
||||
log("收到正向Websocket消息", receiveData);
|
||||
} catch (e) {
|
||||
return wsReply(wsClient, OB11Response.error("json解析失败,请检查数据格式", 1400, echo))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user