-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spectator mode #172
Spectator mode #172
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! I just added a minor question.
On a side note, it probably makes sense to start using a proper logger instead of just console
at some point. I'll create an issue for that.
return await next(); | ||
} | ||
} catch (err) { | ||
console.error( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of error cases can be caught here? Is it only actual errors that represent bugs, or can the user also cause errors here by incorrectly using the software?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it is both. E.g. a user could send a request without Authorization
header. Then credentials === undefined
and calling credentials.name
would raise an exception.
But yes, by just using the software (correctly or incorrectly) one should not run into this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this is the case, I think we should differentiate the cases. Problems resulting from users incorrectly using the software should not be logged on the error level. Only actual errors in the software that require intervention / bugfixing should be logged in that level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Changed it such that user-errors are logged on log-level and unexpected errors are logged on error-level.
This pull request introduces a spectator mode, i.e. a link to a readonly view of the game indented for a moderator.
The idea behind this is described in this documentation: If the
playerID
isundefined
then boardgame.io defines a readonly view. The "player" of this view cannot participate in the game.For the spectator mode, the following changes where added:
playerID=undefined
is generated in the react appkoajs
middleware checks for correct player credentials or correct spectator credentialsResolves #74