Skip to content

Use functional options for creating and joining rooms#767

Merged
kegsay merged 3 commits intomainfrom
kegan/must-join-room-custom-impl
Mar 5, 2025
Merged

Use functional options for creating and joining rooms#767
kegsay merged 3 commits intomainfrom
kegan/must-join-room-custom-impl

Conversation

@kegsay
Copy link
Copy Markdown
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
@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