Skip to content

Commit

Permalink
feat(server): Close code and reason are optional
Browse files Browse the repository at this point in the history
Closes #547
  • Loading branch information
enisdenjo committed Mar 27, 2024
1 parent db47a66 commit 6ae6e6f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/server.ts
Expand Up @@ -240,8 +240,8 @@ export interface ServerOptions<
*/
onDisconnect?: (
ctx: Context<P, E>,
code: number,
reason: string,
code?: number,
reason?: string,
) => Promise<void> | void;
/**
* Called when the socket closes for whatever reason, at any
Expand All @@ -259,8 +259,8 @@ export interface ServerOptions<
*/
onClose?: (
ctx: Context<P, E>,
code: number,
reason: string,
code?: number,
reason?: string,
) => Promise<void> | void;
/**
* The subscribe callback executed right after
Expand Down Expand Up @@ -417,7 +417,7 @@ export interface Server<E = undefined> {
opened(
socket: WebSocket,
ctxExtra: E,
): (code: number, reason: string) => Promise<void>; // closed
): (code?: number, reason?: string) => Promise<void>; // closed
}

/** @category Server */
Expand Down

0 comments on commit 6ae6e6f

Please sign in to comment.