-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Base code, tests and build setup for new LiveObjects plugin. Adds a new `.liveObjects` property for RealtimeChannel. Plugin setup is based on Web Push plugin PR [1], and CDN setup for Push plugin PR [2]. Resolves DTP-947 [1] #1775 [2] #1861
- Loading branch information
Showing
16 changed files
with
277 additions
and
10 deletions.
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; | ||
|
||
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.