-
Notifications
You must be signed in to change notification settings - Fork 50
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
refactoring of terminator strings; http endpoint to list clients per channel #34
base: master
Are you sure you want to change the base?
Conversation
This is a pretty simple change. buffer() has been deprecated, and the parameter being used already for buffer() in the original node.js file is fitting for the recommended command to use instead which is buffer.alloc().
typically, to find how many people are in lobby you just post a message to lobby, something like WHO_WANTS_TO_PLAY and see who responds. this way you'll get only alive clients who are not just connected, but also respond |
But how do you address every channel? Or you make everyone go to a looby channel? |
yep, there should be a dedicated lobby channel that is called, you know, lobby |
looks good, please fix conflicts |
@dr3am3r but I failed to confirm whether you're interested in applying the 2 commits and their features. Are you? |
well, I would approach getting number of people in the room by extending the messaging protocol, not by creating a new endpoint. Also, regarding protocol configuration, it should be separated from the codebase with some sort of .json file and shared between all services, which use it. |
I felt the need to list number of clients per channel in noobhub to provide some sort of lobby feature in game. I initially spiked it as messages in the protocol. I got it to work, but found that approach would:
Attempted this very simple satellite HTTP endpoint instead. It asks for totals from TCP sockets (or compounds both TCP and WS). While the bootstrap/hooks logic in node.js isn't particularly readable, there's a clear separation of concerns and this way both features remain optional, in the spirit of the initial PR. No breakage with original project as well.
I suggest you look at this PR one commit at a time: the first one refactors terminator strings (more lines changed but linear to analyze in isolation I hope), the second one adds the http endpoint and hook counting function on both existing protocols to report back to it.
Tell me if you:
Cheers!