diff --git a/types/phoenix/index.d.ts b/types/phoenix/index.d.ts index 22a4d25f40..526b970e48 100644 --- a/types/phoenix/index.d.ts +++ b/types/phoenix/index.d.ts @@ -36,18 +36,21 @@ export class Channel { push(event: string, payload: object, timeout?: number): Push; } +export type BinaryType = 'arraybuffer' | 'blob'; export type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed'; export interface SocketConnectOption { + binaryType: BinaryType; params: object | (() => object); transport: string; timeout: number; heartbeatIntervalMs: number; - reconnectAfterMs: number; longpollerTimeout: number; encode: (payload: object, callback: (encoded: any) => void) => void; decode: (payload: string, callback: (decoded: any) => void) => void; logger: (kind: string, message: string, data: any) => void; + reconnectAfterMs: (tries: number) => number; + rejoinAfterMs: (tries: number) => number; } export class Socket { diff --git a/types/phoenix/phoenix-tests.ts b/types/phoenix/phoenix-tests.ts index f0b0937851..86da971e05 100644 --- a/types/phoenix/phoenix-tests.ts +++ b/types/phoenix/phoenix-tests.ts @@ -1,7 +1,12 @@ import { Socket, Channel, Presence } from 'phoenix'; function test_socket() { - const socket = new Socket('/ws', {params: {userToken: '123'}}); + const socket = new Socket('/ws', { + binaryType: 'arraybuffer', + params: { userToken: '123' }, + reconnectAfterMs: tries => 1000, + rejoinAfterMs: tries => 1000, + }); socket.connect(); }