-
Notifications
You must be signed in to change notification settings - Fork 0
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
[backend] invite to play #224
Conversation
WalkthroughThe recent updates involve enhancing a chat application to support an invite pong game feature. The backend now handles new WebSocket messages for inviting and approving participants in this game. A unique ID generation functionality has been added for message tracking, and the chat service has been expanded to manage invitations through a mapping system. Additionally, comprehensive end-to-end tests have been implemented to ensure the feature works correctly, including the setup of WebSocket connections and various invitation scenarios. Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
getUsersBlockedBy method in ChatService
…approve user, user will receive error-pong event
}, 500), | ||
)); | ||
}); | ||
describe('invite -> cancel -> invite', () => { |
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.
このテストをするのであれば、cancelを挟まずにinvite -> inviteのケースもあるとより良いと思います。
|
||
getUser(client: Socket) { | ||
return this.users.get(client.id); | ||
} | ||
|
||
getWsFromUserId(userId: number): Socket | undefined { |
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.
ほぼ同じような機能の関数なのでgetUserかgetWsFromUserIdのどちらかにフォーマット合わせた方が良いかも?
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.
フォーマット?
返り値の型を無くすみたいな話ですか?
let userAndSockets: UserAndSocket[]; | ||
|
||
beforeAll(() => { | ||
const users = [user1, user2, mutedUser1, kickedUser1]; |
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.
kickedUser1は使っていなさそうです。
test を追加しました
chat namespace にevent を追加しました
block している されている user には invite 出来ない. ( server 側で制御 )
web socket を使うテストでは、綺麗に書けたんじゃないかなって思います!
エラー時 (approve ) にクライアントにエラーメッセージを送信
TODO
frontend側
deny-pong
message と name space は分けなくていいのか?