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

Tutorial for implementing rooms #43

Closed
inmylo opened this issue Jun 19, 2018 · 1 comment
Closed

Tutorial for implementing rooms #43

inmylo opened this issue Jun 19, 2018 · 1 comment

Comments

@inmylo
Copy link

inmylo commented Jun 19, 2018

Hello!

I understand why you prefer to keep melody as much simple as possible. However, I'm not really sure what is the recommended way to implement rooms. May I ask for the example or short tutorial?

I would like to see that broadcasting happens for the related room's clients only, without the need to filter all existing server clients.

My first thought was to call m := melody.New() multiple times, for every room, but this is confusing me:

r.GET("/ws", func(c *gin.Context) {
	m.HandleRequest(c.Writer, c.Request)
})

... handler is created only once.

Could you please show how would you implement rooms? Performance among one room's users broadcasting is most important.

@azillion
Copy link

https://github.com/olahol/melody/tree/master/examples/multichat
I think this is what you're looking for

@inmylo inmylo closed this as completed Jan 3, 2019
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