teach tests about the new way we fail websockets

This commit is contained in:
dakkar 2025-09-19 13:33:22 +01:00
parent e111d8aa55
commit 77852b8cce
3 changed files with 11 additions and 2 deletions

View file

@ -377,6 +377,12 @@ export function connectStream<C extends keyof misskey.Channels>(user: UserToken,
const ws = new WebSocket(url, options);
ws.on('unexpected-response', (req, res) => rej(res));
ws.on('close', (code, reason) => {
rej({
statusCode: code,
reason: reason.toString('utf8'),
});
});
ws.on('open', () => {
ws.on('message', data => {
const msg = JSON.parse(data.toString());