Skip to content
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

请教一下,这里为什么用的是map[*Session]struct{} #93

Open
jsasg opened this issue Apr 18, 2024 · 1 comment
Open

请教一下,这里为什么用的是map[*Session]struct{} #93

jsasg opened this issue Apr 18, 2024 · 1 comment

Comments

@jsasg
Copy link

jsasg commented Apr 18, 2024

type sessionSet struct { mu sync.RWMutex members map[*Session]struct{} }
请教一下,这里为什么用的是map[*Session]struct{},而不是map[key]*Session,比如key是user_id这种,发消息给精确的某个人的时候这种不是应该性能更好吗

@mimicode
Copy link

和业务无关, 如果想 通过key 代表用户user_id,可以自定义有个session管理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants