Skip to content

Commit

Permalink
fix(server): return instead of break at switch case ends
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Mar 17, 2021
1 parent d1421ad commit e9447e4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/server.ts
Expand Up @@ -515,7 +515,7 @@ export function makeServer<E = unknown>(options: ServerOptions<E>): Server<E> {

// @ts-expect-error: I can write
ctx.acknowledged = true;
break;
return;
}
case MessageType.Subscribe: {
if (!ctx.acknowledged) {
Expand Down Expand Up @@ -687,12 +687,12 @@ export function makeServer<E = unknown>(options: ServerOptions<E>): Server<E> {
// completed the subscription, he doesnt need to be reminded
await emit.complete(id in ctx.subscriptions);
delete ctx.subscriptions[id];
break;
return;
}
case MessageType.Complete: {
await ctx.subscriptions[message.id]?.return?.();
delete ctx.subscriptions[message.id]; // deleting the subscription means no further activity should take place
break;
return;
}
default:
throw new Error(
Expand Down

0 comments on commit e9447e4

Please sign in to comment.