Skip to content

Commit

Permalink
chore: if an error occurs during the $connect action, close the conne…
Browse files Browse the repository at this point in the history
…ction
  • Loading branch information
frsechet committed Jul 2, 2019
1 parent 1ba79f2 commit b83c123
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ApiGatewayWebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ module.exports = class ApiGatewayWebSocket {
ws.send(JSON.stringify({ message:'Internal server error', connectionId, requestId:'1234567890' }));
}

// mimic AWS behaviour (close connection) when the $connect action handler throws
if (name === '$connect') {
ws.close();
}

debugLog(`Error in handler of action ${action}`, err);
};

Expand Down

0 comments on commit b83c123

Please sign in to comment.