We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dfa1d65 commit f079d84Copy full SHA for f079d84
packages/core/realtime-js/src/RealtimeChannel.ts
@@ -266,8 +266,18 @@ export default class RealtimeChannel {
266
send(
267
payload: { type: string; [key: string]: any },
268
opts: { [key: string]: any } = {}
269
- ): Push {
270
- return this.push(payload.type as any, payload, opts.timeout ?? this.timeout)
+ ): Promise<'ok' | 'timeout'> {
+ const push = this.push(
271
+ payload.type as any,
272
+ payload,
273
+ opts.timeout ?? this.timeout
274
+ )
275
+
276
+ return new Promise((resolve) => {
277
+ push
278
+ .receive('ok', () => resolve('ok'))
279
+ .receive('timeout', () => resolve('timeout'))
280
+ })
281
}
282
283
replyEventName(ref: string): string {
0 commit comments