import type { PublishChannel } from '@wix/realtime-common/types'; import type { HttpClient } from '@wix/sdk-types'; interface PublishSignature { /** * Publishes a message to a channel or resource. * * The method publishes a message to all subscribers on the specified channel or resource. Channels and resources are independent, so subscribers to a channel don't receive messages sent to a resource on that channel. Similarly, subscribers to a resource don't receive messages sent to its parent channel. * * > **Authentication** * > * > This method may require higher-level permissions than the caller has, based on their [identity](https://dev.wix.com/docs/api-reference/articles/authentication/about-identities) and [roles and permissions](https://support.wix.com/en/article/roles-permissions-overview). In these cases, you can ensure the method is called with the required level of authorization by using [elevated permissions](https://dev.wix.com/docs/api-reference/articles/authentication/about-elevated-permissions). * * * * @example Publish a message to the specified channel * ```ts * import { publisher } from '@wix/realtime'; * import { elevate } from '@wix/sdk/context'; * * const elevatedPublish = elevate(publisher.publish); * await elevatedPublish({ name: 'my-channel' }, { text: 'hello' }); * ``` * * @example Publish a message to the specified channel: Self-hosted * ```ts * import { publisher } from '@wix/realtime'; * import { createClient } from '@wix/sdk'; * * // Import the auth strategy for the relevant access type * // Import the relevant host module if needed * * const client = createClient({ * modules: { publisher }, * // Include the auth strategy and host as relevant * }); * * await client.publisher.publish({ name: 'my-channel' }, { text: 'hello' }); * ``` * * @param channel - Channel and resource to publish to. * @requiredField channel * @param payload - Message payload. Max: 10 KB. * @requiredField payload * @permissionScope Publish Realtime Messages * @permissionScopeId SCOPE.API_INFRA.REALTIME_PUBLISH * @fqn com.wix.realtime.v4.DuplexerApiV4.Publish */ (channel: PublishChannel, payload: Record): Promise; } /** @hidden */ export declare function publish(httpClient: HttpClient): PublishSignature; export {};