-
Notifications
You must be signed in to change notification settings - Fork 56
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
[DTP-947] Expose LiveObjects as a plugin #1880
Merged
VeskeR
merged 2 commits into
integration/liveobjects
from
DTP-947/liveobjects-plugin-base
Oct 8, 2024
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// The ESLint warning is triggered because we only use these types in a documentation comment. | ||
/* eslint-disable no-unused-vars, @typescript-eslint/no-unused-vars */ | ||
import { RealtimeClient } from './ably'; | ||
import { BaseRealtime } from './modular'; | ||
/* eslint-enable no-unused-vars, @typescript-eslint/no-unused-vars */ | ||
|
||
/** | ||
* Provides a {@link RealtimeClient} instance with the ability to use LiveObjects functionality. | ||
* | ||
* To create a client that includes this plugin, include it in the client options that you pass to the {@link RealtimeClient.constructor}: | ||
* | ||
* ```javascript | ||
* import { Realtime } from 'ably'; | ||
* import LiveObjects from 'ably/liveobjects'; | ||
* const realtime = new Realtime({ ...options, plugins: { LiveObjects } }); | ||
* ``` | ||
* | ||
* The LiveObjects plugin can also be used with a {@link BaseRealtime} client | ||
* | ||
* ```javascript | ||
* import { BaseRealtime, WebSocketTransport, FetchRequest } from 'ably/modular'; | ||
* import LiveObjects from 'ably/liveobjects'; | ||
* const realtime = new BaseRealtime({ ...options, plugins: { WebSocketTransport, FetchRequest, LiveObjects } }); | ||
* ``` | ||
*/ | ||
declare const LiveObjects: any; | ||
VeskeR marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
export = LiveObjects; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import LiveObjects from './liveobjects'; | ||
import Push from './push'; | ||
|
||
export interface StandardPlugins { | ||
LiveObjects?: typeof LiveObjects; | ||
Push?: typeof Push; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { LiveObjects } from './liveobjects'; | ||
|
||
export { LiveObjects }; | ||
|
||
export default { | ||
LiveObjects, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type BaseClient from 'common/lib/client/baseclient'; | ||
import type RealtimeChannel from 'common/lib/client/realtimechannel'; | ||
|
||
export class LiveObjects { | ||
private _client: BaseClient; | ||
private _channel: RealtimeChannel; | ||
|
||
constructor(channel: RealtimeChannel) { | ||
this._channel = channel; | ||
this._client = channel.client; | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is confusing to me, we have an artefact called
liveobjects.js
and another calledliveobjects.umd.js
but they're exactly the same. i assume this one was meant to be esmThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the second
liveObjectsPluginCdnConfig
(and thirdminifiedLiveObjectsPluginCdnConfig
) configs are for CDN LiveObjects bundles.the implementation is based on our CDN for Push plugin #1861.
Push plugin used
*.umd.js
naming convention for its CDN plugin, so I've used the same here for LiveObjects CDN plugin.you're right that cdn and regular configs for LiveObjects are the same right now - as LiveObjects plugin doesn't have any external dependencies at this moment, but 1. that can easily change in the future, 2. we wouldn't want to change a name for a CDN script for LiveObjects in the future