wss链接改变导致脚本失效?
Closed this issue · 1 comments
gl46 commented
(本人纯小白,如有出错还请见谅)
我调用api时后台报错显示建立wss链接错误,对比了后台建立的链接wss://www.perplexity.ai:443/socket.io/?EIO=4&transport=websocket与官网的wss链接,似乎现在官网的会在每次打开网页后面加一串会话id
请问大佬有时间方便修下脚本吗,谢谢
以下是报错消息
[ { role: 'user', content: '你好' } ]
TransportError: websocket error
at WS.onError (/root/pplx-proxy/node_modules/engine.io-client/build/cjs/transport.js:47:37) at ws.onerror (/root/pplx-proxy/node_modules/engine.io-client/build/cjs/transports/websocket.js:77:39)
at callListener (/root/pplx-proxy/node_modules/ws/lib/event-target.js:290:14)
at WebSocket.onError (/root/pplx-proxy/node_modules/ws/lib/event-target.js:230:9)
at WebSocket.emit (node:events:519:28)
at emitErrorAndClose (/root/pplx-proxy/node_modules/ws/lib/websocket.js:1002:13)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
description: ErrorEvent {
[Symbol(kTarget)]: WebSocket {
_events: [Object: null prototype],
_eventsCount: 4,
_maxListeners: undefined,
_binaryType: 'nodebuffer',
_closeCode: 1006,
_closeFrameReceived: false,
_closeFrameSent: false,
_closeMessage: <Buffer >,
_closeTimer: null,
_extensions: {},
_paused: false,
_protocol: '',
_readyState: 2,
_receiver: null,
_sender: null,
_socket: null,
_bufferedAmount: 0,
_isServer: false,
_redirects: 0,
_url: 'wss://www.perplexity.ai:443/socket.io/?EIO=4&transport=websocket',
_req: [ClientRequest],
[Symbol(shapeMode)]: false,
[Symbol(kCapture)]: false
},
[Symbol(kType)]: 'error',
[Symbol(kError)]: Error: Unexpected server response: 403
at ClientRequest.<anonymous> (/root/pplx-proxy/node_modules/ws/lib/websocket.js:886:7)
at ClientRequest.emit (node:events:519:28)
at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:698:27)
at HTTPParser.parserOnHeadersComplete (node:_http_common:119:17)
at TLSSocket.socketOnData (node:_http_client:540:22)
at TLSSocket.emit (node:events:519:28)
at addChunk (node:internal/streams/readable:559:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:510:3)
at Readable.push (node:internal/streams/readable:390:5)
at TLSWrap.onStreamRead (node:internal/stream_base_commons:191:23),
[Symbol(kMessage)]: 'Unexpected server response: 403'
},
context: undefined,
type: 'TransportError'
}
> [Client closed]
Archeb commented
403 是 cloudflare 拦截 和这个没关系,没有这个 id 一样可以正常连接的