wirejs-deploy-amplify-basic 0.0.107-realtime → 0.0.108-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.
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
onmessage: (data: any) => void;
|
|
3
|
-
onclose?: () => void;
|
|
4
|
-
};
|
|
1
|
+
import type { MessageStreamSubscriber } from "wirejs-resources";
|
|
5
2
|
export type ChannelEvent<T = any> = {
|
|
6
|
-
type: "data" | "broadcast_error" | "ka";
|
|
3
|
+
type: "subscribe_success" | "data" | "broadcast_error" | "ka";
|
|
7
4
|
id: string;
|
|
8
5
|
event: any;
|
|
9
6
|
};
|
|
10
|
-
export declare function subscribe(url: string, channel: string, token: string, authHost: string, subscriber:
|
|
11
|
-
export declare function unsubscribe(url: string, channel: string, subscriber:
|
|
7
|
+
export declare function subscribe(url: string, channel: string, token: string, authHost: string, subscriber: MessageStreamSubscriber): void;
|
|
8
|
+
export declare function unsubscribe(url: string, channel: string, subscriber: MessageStreamSubscriber): void;
|
package/dist/client/realtime.js
CHANGED
|
@@ -58,6 +58,16 @@ export function subscribe(url, channel, token, authHost, subscriber) {
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
else if (data.type === 'subscribe_success') {
|
|
62
|
+
for (const subscriber of subscribers.get(data.id) || []) {
|
|
63
|
+
try {
|
|
64
|
+
subscriber.onopen?.();
|
|
65
|
+
}
|
|
66
|
+
catch (error) {
|
|
67
|
+
console.error('Error in subscriber onopen:', error);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
61
71
|
};
|
|
62
72
|
ws.onclose = event => {
|
|
63
73
|
const subscriptionIds = Array.from(channelSubs.keys())
|
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.108-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.76-realtime"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@aws-amplify/backend": "^1.14.0",
|