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

Use functional options for creating and joining rooms #767

Merged
merged 3 commits into from
Mar 5, 2025

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Mar 4, 2025

This is much more ergonomic and clear from call-sites what is happening.

Also, fix chicken/egg problem with ServerRoom and ServerRoomImpl.

To make the impl you need a room. To make a room you need an impl.
Instead, pass in the room to the impl so you do not need a room to
make an impl. This makes the way you call the impl a bit less elegant
as you refer to the room twice e.g room.EventCreator(room, ...) but
allows custom impls to use functional options.

This is much more ergonomic and clear from call-sites what is happening.
@kegsay kegsay requested a review from devonh March 4, 2025 08:47
@kegsay kegsay requested review from a team as code owners March 4, 2025 08:47
kegsay added 2 commits March 4, 2025 09:37
To make the impl you need a room. To make a room you need an impl.
Instead, pass in the room to the impl so you do not need a room to
make an impl. This makes the way you call the impl a bit less elegant
as you refer to the room twice e.g `room.EventCreator(room, ...)` but
allows custom impls to use functional options.
@kegsay kegsay merged commit 3fbfb75 into main Mar 5, 2025
4 checks passed
@kegsay kegsay deleted the kegan/must-join-room-custom-impl branch March 5, 2025 09:29
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

Successfully merging this pull request may close these issues.

2 participants