colyseus / colyseus-social

Authentication and Social features
https://docs.colyseus.io/tools/colyseus-social/
MIT License
21 stars 17 forks source link

How to send game invites #11

Open bhgsbatista opened 4 years ago

bhgsbatista commented 4 years ago

Without messaging functionality, how could one go about sending invites and creating parties that join rooms together with colyseus-social?

endel commented 4 years ago

Hi @bhgsbatista, this module doesn't provide such features - it's only for authentication and user management.

I couldn't come up with a nice & clean approach to allow this so far. If you have any ideas or feedback I appreciate it. Cheers

bhgsbatista commented 4 years ago

Probably the best way would be to create Mailbox models connected to users. We could leverage the preInsert hook to create a MailBox and add its ID to the user. This functionality could be toggled on and off based on game need, and since we're already connected to Mongo adding inboxes should not be too complicated. Blocked users would be prevented from inserting messages into my mailbox. Otherwise any other user could request to add messages to my inbox, and therefore each game could implement a special Administrator user account to send messages on behalf of the game.

As for parties, I think we could leverage a special PartyRoom that would function as a private Lobby of sorts. This would integrate nicely with Colyseus architecture and would make implementing party chat functionality (at least written chat) trivial. The platform would just need to verify that rooms the party is trying to join have enough open slots, and that when users leave the room, they return to the PartyRoom if they are still in the party.

Hope this gave you some ideas, I know it's not a simple ask, but I'm hoping this library keeps adding new features and moving forward.