summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorcannorin <13620400+cannorin@users.noreply.github.com>2025-01-14 21:20:24 +0900
committerGitHub <noreply@github.com>2025-01-14 12:20:24 +0000
commit319f7e6a862d1ec943329f8d6bfaaf04f77337ba (patch)
tree94c52dc4fdea7a980df9704f087e9d0d14fa82d0 /packages
parentノートのリンクをリモートのサーバーのURLとしてもコピ... (diff)
downloadmisskey-319f7e6a862d1ec943329f8d6bfaaf04f77337ba.tar.gz
misskey-319f7e6a862d1ec943329f8d6bfaaf04f77337ba.tar.bz2
misskey-319f7e6a862d1ec943329f8d6bfaaf04f77337ba.zip
feat(misskey-js): allow setting binaryType of WebSocket connection (#15190)
Co-authored-by: cannorin <cannorin@users.noreply.github.com> Co-authored-by: syuilo <4439005+syuilo@users.noreply.github.com>
Diffstat (limited to 'packages')
-rw-r--r--packages/misskey-js/etc/misskey-js.api.md3
-rw-r--r--packages/misskey-js/src/streaming.ts4
2 files changed, 7 insertions, 0 deletions
diff --git a/packages/misskey-js/etc/misskey-js.api.md b/packages/misskey-js/etc/misskey-js.api.md
index 3ff8fdc844..211ddb8287 100644
--- a/packages/misskey-js/etc/misskey-js.api.md
+++ b/packages/misskey-js/etc/misskey-js.api.md
@@ -8,6 +8,7 @@ import type { AuthenticationResponseJSON } from '@simplewebauthn/types';
import { EventEmitter } from 'eventemitter3';
import { Options } from 'reconnecting-websocket';
import type { PublicKeyCredentialRequestOptionsJSON } from '@simplewebauthn/types';
+import _ReconnectingWebSocket from 'reconnecting-websocket';
// Warning: (ae-forgotten-export) The symbol "components" needs to be exported by the entry point index.d.ts
//
@@ -3159,6 +3160,7 @@ export class Stream extends EventEmitter<StreamEvents> implements IStream {
token: string;
} | null, options?: {
WebSocket?: Options['WebSocket'];
+ binaryType?: ReconnectingWebSocket['binaryType'];
});
// (undocumented)
close(): void;
@@ -3421,6 +3423,7 @@ type UsersUpdateMemoRequest = operations['users___update-memo']['requestBody']['
// Warnings were encountered during analysis:
//
// src/entities.ts:50:2 - (ae-forgotten-export) The symbol "ModerationLogPayloads" needs to be exported by the entry point index.d.ts
+// src/streaming.ts:57:3 - (ae-forgotten-export) The symbol "ReconnectingWebSocket" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:220:4 - (ae-forgotten-export) The symbol "ReversiUpdateKey" needs to be exported by the entry point index.d.ts
// src/streaming.types.ts:230:4 - (ae-forgotten-export) The symbol "ReversiUpdateSettings" needs to be exported by the entry point index.d.ts
diff --git a/packages/misskey-js/src/streaming.ts b/packages/misskey-js/src/streaming.ts
index fec6114cca..0ef2d1e7a1 100644
--- a/packages/misskey-js/src/streaming.ts
+++ b/packages/misskey-js/src/streaming.ts
@@ -54,6 +54,7 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
constructor(origin: string, user: { token: string; } | null, options?: {
WebSocket?: Options['WebSocket'];
+ binaryType?: ReconnectingWebSocket['binaryType'];
}) {
super();
@@ -86,6 +87,9 @@ export default class Stream extends EventEmitter<StreamEvents> implements IStrea
minReconnectionDelay: 1, // https://github.com/pladaria/reconnecting-websocket/issues/91
WebSocket: options.WebSocket,
});
+ if (options.binaryType) {
+ this.stream.binaryType = options.binaryType;
+ }
this.stream.addEventListener('open', this.onOpen);
this.stream.addEventListener('close', this.onClose);
this.stream.addEventListener('message', this.onMessage);