wirejs-deploy-amplify-basic 0.0.92-realtime → 0.0.93-realtime
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client/realtime.js
CHANGED
|
@@ -82,14 +82,23 @@ export function subscribe(url, channel, token, subscriber) {
|
|
|
82
82
|
}
|
|
83
83
|
if (!channelSubs.has(channel)) {
|
|
84
84
|
const subscriptionId = crypto.randomUUID();
|
|
85
|
-
connections.get(url)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
const ws = connections.get(url);
|
|
86
|
+
const subscribe = () => {
|
|
87
|
+
ws.send(JSON.stringify({
|
|
88
|
+
id: subscriptionId,
|
|
89
|
+
type: 'subscribe',
|
|
90
|
+
channel,
|
|
91
|
+
authorization
|
|
92
|
+
}));
|
|
93
|
+
channelSubs.set(fullChannelName, subscriptionId);
|
|
94
|
+
subscribers.set(subscriptionId, []);
|
|
95
|
+
};
|
|
96
|
+
if (ws.readyState === WebSocket.OPEN) {
|
|
97
|
+
subscribe();
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
ws.addEventListener('open', subscribe);
|
|
101
|
+
}
|
|
93
102
|
}
|
|
94
103
|
subscribers.get(fullChannelName).push(subscriber);
|
|
95
104
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,3 +2,4 @@ export * from 'wirejs-resources';
|
|
|
2
2
|
export { FileService } from './services/file.js';
|
|
3
3
|
export { AuthenticationService } from './services/authentication.js';
|
|
4
4
|
export { DistributedTable } from './resources/distributed-table.js';
|
|
5
|
+
export { RealtimeService } from './services/realtime.js';
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,10 @@ import { AuthenticationService } from './services/authentication.js';
|
|
|
8
8
|
export { AuthenticationService } from './services/authentication.js';
|
|
9
9
|
import { DistributedTable } from './resources/distributed-table.js';
|
|
10
10
|
export { DistributedTable } from './resources/distributed-table.js';
|
|
11
|
+
import { RealtimeService } from './services/realtime.js';
|
|
12
|
+
export { RealtimeService } from './services/realtime.js';
|
|
11
13
|
// expose resources to other resources that might depend on it.
|
|
12
14
|
overrides.AuthenticationService = AuthenticationService;
|
|
13
15
|
overrides.DistributedTable = DistributedTable;
|
|
14
16
|
overrides.FileService = FileService;
|
|
17
|
+
overrides.RealtimeService = RealtimeService;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as jose from 'jose';
|
|
2
2
|
import { Resource, Secret } from 'wirejs-resources';
|
|
3
|
-
import { addResource } from '../resource-collector.js';
|
|
4
3
|
import { SignatureV4 } from '@aws-sdk/signature-v4';
|
|
5
4
|
import { HttpRequest } from '@aws-sdk/protocol-http';
|
|
6
5
|
import { defaultProvider } from '@aws-sdk/credential-provider-node';
|
|
7
6
|
import { Sha256 } from '@aws-crypto/sha256-js';
|
|
7
|
+
import { addResource } from '../resource-collector.js';
|
|
8
8
|
export const SECRET_ID = 'realtime-secret';
|
|
9
9
|
export class RealtimeService extends Resource {
|
|
10
10
|
#secret;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wirejs-deploy-amplify-basic",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.93-realtime",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"recursive-copy": "^2.0.14",
|
|
42
42
|
"rimraf": "^6.0.1",
|
|
43
43
|
"wirejs-dom": "^1.0.41",
|
|
44
|
-
"wirejs-resources": "^0.1.
|
|
44
|
+
"wirejs-resources": "^0.1.61-realtime"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@aws-amplify/backend": "^1.14.0",
|