Authentication with Socket.IO challenge raised a question for me. Particularly this one function
in snippet.
function onAuthorizeFail(data, message, error, accept) {
if (error) throw new Error(message);
console.log('failed connection to socket.io:', message);
accept(null, false);
}
Previously curriculum said that the first argument of CB is conventionally for passing errors. And through examples usually it were demonstrated. And the question is why in this case we rethrow the error
and then also call CB-function with null
parameter for error-argument?