Skip to content

Commit

Permalink
Merge pull request #133 from GreenAsJade/supply_status_with_disconnect
Browse files Browse the repository at this point in the history
Supply the error code with the disconnect event
  • Loading branch information
anoek authored Oct 5, 2023
2 parents bb7dd80 + e7120d8 commit ac56db0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/GobanSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type GobanSocketServerToClientMessage<RecvProtocol> = [keyof RecvProtocol | numb
// doesn't seem to be possible in typescript yet
export interface GobanSocketEvents extends ServerToClient {
connect: () => void;
disconnect: () => void;
disconnect: (code: number) => void;
reconnect: () => void;
unrecoverable_error: (code: number, tag: string, message: string) => void;
/* Emitted when we receive an updated latency measurement */
Expand Down Expand Up @@ -263,7 +263,7 @@ export class GobanSocket<
this.rejectPromisesInFlight();

try {
this.emit("disconnect");
this.emit("disconnect", event.code);
} catch (e) {
console.error("Error in disconnect handler", e);
}
Expand Down

0 comments on commit ac56db0

Please sign in to comment.