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

[SDK-3936] Remove remaining REST code from BaseRealtime #1496

Conversation

lawrence-forooghian
Copy link
Collaborator

@lawrence-forooghian lawrence-forooghian commented Nov 10, 2023

Note: This PR is based on top of #1476; please review that one first.

This adds further testing around how BaseRealtime behaves when you do and don't provide the Rest module, and then addresses the REST-related code that BaseRealtime was pulling in even when the Rest module was not provided. See commit messages for more details.

Resolves #1489.

@lawrence-forooghian lawrence-forooghian changed the base branch from main to 1474-package-test November 10, 2023 12:42
@github-actions github-actions bot temporarily deployed to staging/pull/1496/features November 10, 2023 12:42 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the 1489-remove-remaining-REST-code-from-BaseRealtime branch from 13841cb to a9d85a5 Compare November 10, 2023 12:46
@github-actions github-actions bot temporarily deployed to staging/pull/1496/features November 10, 2023 12:46 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1496/typedoc November 10, 2023 12:47 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1496/bundle-report November 10, 2023 12:47 Inactive
@lawrence-forooghian lawrence-forooghian force-pushed the 1489-remove-remaining-REST-code-from-BaseRealtime branch from a9d85a5 to cf1d07a Compare November 10, 2023 13:30
@github-actions github-actions bot temporarily deployed to staging/pull/1496/features November 10, 2023 13:30 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1496/bundle-report November 10, 2023 13:31 Inactive
@github-actions github-actions bot temporarily deployed to staging/pull/1496/typedoc November 10, 2023 13:31 Inactive
@lawrence-forooghian lawrence-forooghian marked this pull request as ready for review November 10, 2023 17:27
@lawrence-forooghian lawrence-forooghian changed the title Remove remaining REST code from BaseRealtime [SDK-3936] Remove remaining REST code from BaseRealtime Nov 13, 2023
List all of the functionality that’s gated off by this module and check
that it works when the module is provided, and doesn’t when it’s not.

Also test that Realtime doesn’t need this module in order to publish and
subscribe.
Not having to deal with the overload signature will make an upcoming
refactor easier.
I consider this to be REST functionality, and so to reduce bundle size
it shouldn’t be bundled with a BaseRealtime client. I should have done
this in 89c0761.
Groundwork for removing the Realtime versions’ inheritance.
There is code that’s exclusively needed by the REST version of these
classes (e.g. presence `get()`, channel `publish()`), and which, in
order to reduce bundle size, we don’t want to pull in when importing the
BaseRealtime class. In order to do this, we need to sever the
inheritance relation between the Realtime and REST version of these
classes. (It’s also worth noting that, similarly to what I mentioned in
69c35f1, the IDL doesn’t mention any inheritance relation.)

The REST versions of these classes also contain functionality (channel
history and presence history, channel status) that should only be
available to a BaseRealtime client if the user has explicitly requested
REST functionality (by importing the Rest module). So, we gate this
functionality behind the Rest module (I should really have done this in
89c0761) and in doing so further reduce the bundle size of a REST-less
BaseRealtime.

I’ve moved the channel and presence REST code that’s also conditionally
needed by Realtime into classes called RestChannelMixin and
RestPresenceMixin. There’s no massively compelling reason for these
classes to exist, I just thought it might be good not to dump everything
directly inside the Rest module.

Resolves #1489.
Copy link
Member

@owenpearson owenpearson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Base automatically changed from 1474-package-test to integration/v2 November 21, 2023 00:16
@lawrence-forooghian lawrence-forooghian merged commit cdcf043 into integration/v2 Nov 21, 2023
12 checks passed
@lawrence-forooghian lawrence-forooghian deleted the 1489-remove-remaining-REST-code-from-BaseRealtime branch November 21, 2023 00:17
@VeskeR VeskeR mentioned this pull request Mar 1, 2024
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Tree-shakable library without Rest module shouldn't include Resource or PaginatedResource
2 participants