Skip to content

Commit

Permalink
Merge pull request #726 from frsechet/fix/aws-difference
Browse files Browse the repository at this point in the history
close connection on error in $connect action handler
  • Loading branch information
dherault committed Jul 2, 2019
2 parents 27e1e05 + b83c123 commit b9b1d72
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ApiGatewayWebSocket.js
Expand Up @@ -98,6 +98,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 b9b1d72

Please sign in to comment.