{
  "typeDocModel": {
    "schemaVersion": "2.0",
    "id": 0,
    "name": "@wix/realtime",
    "variant": "project",
    "kind": 1,
    "flags": {},
    "children": [
      {
        "id": 12,
        "name": "publisher",
        "variant": "declaration",
        "kind": 4,
        "flags": {},
        "children": [
          {
            "id": 72,
            "name": "PublishChannel",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Realtime broadcast published channel. Publishers send messages to channels and subscribers listen to them."
                }
              ]
            },
            "children": [
              {
                "id": 73,
                "name": "name",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Channel name.\n\n> **Notes:**\n> - Supports only alphanumeric characters, hyphens, and underscores.\n> - The combined length of "
                    },
                    {
                      "kind": "code",
                      "text": "`name`"
                    },
                    {
                      "kind": "text",
                      "text": " and "
                    },
                    {
                      "kind": "code",
                      "text": "`resourceId`"
                    },
                    {
                      "kind": "text",
                      "text": " can't exceed 140 characters."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              },
              {
                "id": 74,
                "name": "resourceId",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Resource ID.\n\nResources are independent sub-channels in a channel. A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  73,
                  74
                ]
              }
            ]
          },
          {
            "id": 13,
            "name": "publish",
            "variant": "declaration",
            "kind": 64,
            "flags": {},
            "signatures": [
              {
                "id": 14,
                "name": "publish",
                "variant": "signature",
                "kind": 4096,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Publishes a message to a channel or resource.\n\nThe 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.\n\n> **Authentication**\n>\n> 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).\n\n<!-- TODO: Check whether this API is relevant for headless projects. -->"
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@example",
                      "name": "Publish a message to the specified channel",
                      "content": [
                        {
                          "kind": "code",
                          "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { elevate } from '@wix/sdk/context';\n\nconst elevatedPublish = elevate(publisher.publish);\nawait elevatedPublish({ name: 'my-channel' }, { text: 'hello' });\n```"
                        }
                      ]
                    },
                    {
                      "tag": "@example",
                      "name": "Publish a message to the specified channel: Self-hosted",
                      "content": [
                        {
                          "kind": "code",
                          "text": "```ts\nimport { publisher } from '@wix/realtime';\nimport { createClient } from '@wix/sdk';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n  modules: { publisher },\n  // Include the auth strategy and host as relevant\n});\n\nawait client.publisher.publish({ name: 'my-channel' }, { text: 'hello' });\n```"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "channel"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "payload"
                        }
                      ]
                    },
                    {
                      "tag": "@permissionScope",
                      "content": [
                        {
                          "kind": "text",
                          "text": "Publish Realtime Messages"
                        }
                      ]
                    },
                    {
                      "tag": "@permissionScopeId",
                      "content": [
                        {
                          "kind": "text",
                          "text": "SCOPE.API_INFRA.REALTIME_PUBLISH"
                        }
                      ]
                    },
                    {
                      "tag": "@fqn",
                      "content": [
                        {
                          "kind": "text",
                          "text": "com.wix.realtime.v4.DuplexerApiV4.Publish"
                        }
                      ]
                    }
                  ]
                },
                "parameters": [
                  {
                    "id": 15,
                    "name": "channel",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Channel and resource to publish to."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 72,
                      "name": "PublishChannel",
                      "package": "@wix/realtime-common"
                    }
                  },
                  {
                    "id": 16,
                    "name": "payload",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Message payload. Max: 10 KB."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": {
                        "packageName": "typescript",
                        "packagePath": "lib/lib.es5.d.ts",
                        "qualifiedName": "Record"
                      },
                      "typeArguments": [
                        {
                          "type": "intrinsic",
                          "name": "string"
                        },
                        {
                          "type": "intrinsic",
                          "name": "any"
                        }
                      ],
                      "name": "Record",
                      "package": "typescript"
                    }
                  }
                ],
                "type": {
                  "type": "reference",
                  "target": {
                    "packageName": "typescript",
                    "packagePath": "lib/lib.es5.d.ts",
                    "qualifiedName": "Promise"
                  },
                  "typeArguments": [
                    {
                      "type": "intrinsic",
                      "name": "void"
                    }
                  ],
                  "name": "Promise",
                  "package": "typescript"
                }
              }
            ]
          }
        ],
        "groups": [
          {
            "title": "Interfaces",
            "children": [
              72
            ]
          },
          {
            "title": "Functions",
            "children": [
              13
            ]
          }
        ]
      },
      {
        "id": 1,
        "name": "site",
        "variant": "declaration",
        "kind": 4,
        "flags": {},
        "children": [
          {
            "id": 32,
            "name": "PermissionsRouter",
            "variant": "declaration",
            "kind": 4,
            "flags": {},
            "children": [
              {
                "id": 44,
                "name": "PermissionsRouter",
                "variant": "declaration",
                "kind": 256,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Realtime permissions router.\n\nDefines which subscribers can receive messages on specific channels or resources. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
                    }
                  ]
                },
                "children": [
                  {
                    "id": 45,
                    "name": "add",
                    "variant": "declaration",
                    "kind": 2048,
                    "flags": {},
                    "signatures": [
                      {
                        "id": 46,
                        "name": "add",
                        "variant": "signature",
                        "kind": 4096,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to all of its resources that don't have their own handler.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
                            }
                          ],
                          "blockTags": [
                            {
                              "tag": "@requiredField",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "channel"
                                }
                              ]
                            },
                            {
                              "tag": "@servicePath",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "wix-realtime-backend.Channel"
                                }
                              ]
                            },
                            {
                              "tag": "@requiredField",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "handler"
                                }
                              ]
                            },
                            {
                              "tag": "@servicePath",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "wix-realtime-backend.PermissionsRouter.PermissionsHandler"
                                }
                              ]
                            }
                          ]
                        },
                        "parameters": [
                          {
                            "id": 47,
                            "name": "channel",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Channel or resource to add the permissions handler for."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 61,
                              "name": "Channel",
                              "package": "@wix/realtime-common"
                            }
                          },
                          {
                            "id": 48,
                            "name": "handler",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Handler that runs when checking permissions for the specified channel."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 56,
                              "name": "PermissionsHandler",
                              "package": "@wix/sdk_realtime_site"
                            }
                          }
                        ],
                        "type": {
                          "type": "intersection",
                          "types": [
                            {
                              "type": "reference",
                              "target": {
                                "packageName": "typescript",
                                "packagePath": "lib/lib.es5.d.ts",
                                "qualifiedName": "Promise"
                              },
                              "typeArguments": [
                                {
                                  "type": "intrinsic",
                                  "name": "void"
                                }
                              ],
                              "name": "Promise",
                              "package": "typescript"
                            },
                            {
                              "type": "intrinsic",
                              "name": "void"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "id": 49,
                    "name": "check",
                    "variant": "declaration",
                    "kind": 2048,
                    "flags": {},
                    "signatures": [
                      {
                        "id": 50,
                        "name": "check",
                        "variant": "signature",
                        "kind": 4096,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the associated permissions handler to check whether the subscriber can receive messages on the specified channel or resource. To delegate permissions check to the router, call this method in the body of the ["
                            },
                            {
                              "kind": "code",
                              "text": "`realtime_check_permission()`"
                            },
                            {
                              "kind": "text",
                              "text": "](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/realtime-check-permission) hook."
                            }
                          ],
                          "blockTags": [
                            {
                              "tag": "@requiredField",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "channel"
                                }
                              ]
                            },
                            {
                              "tag": "@servicePath",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "wix-realtime-backend.Channel"
                                }
                              ]
                            },
                            {
                              "tag": "@requiredField",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "subscriber"
                                }
                              ]
                            },
                            {
                              "tag": "@servicePath",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "wix-realtime-backend.Subscriber"
                                }
                              ]
                            },
                            {
                              "tag": "@returns",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "Permissions granted to the subscriber for the specified channel or resource."
                                }
                              ]
                            },
                            {
                              "tag": "@servicePath",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "wix-realtime-backend.ChannelPermissions"
                                }
                              ]
                            }
                          ]
                        },
                        "parameters": [
                          {
                            "id": 51,
                            "name": "channel",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Channel or resource to check permissions for."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 61,
                              "name": "Channel",
                              "package": "@wix/realtime-common"
                            }
                          },
                          {
                            "id": 52,
                            "name": "subscriber",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Subscriber to check permissions for."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 66,
                              "name": "Subscriber",
                              "package": "@wix/realtime-common"
                            }
                          }
                        ],
                        "type": {
                          "type": "intersection",
                          "types": [
                            {
                              "type": "reference",
                              "target": {
                                "packageName": "typescript",
                                "packagePath": "lib/lib.es5.d.ts",
                                "qualifiedName": "Promise"
                              },
                              "typeArguments": [
                                {
                                  "type": "reference",
                                  "target": 64,
                                  "name": "ChannelPermissions",
                                  "package": "@wix/realtime-common"
                                }
                              ],
                              "name": "Promise",
                              "package": "typescript"
                            },
                            {
                              "type": "reference",
                              "target": 64,
                              "name": "ChannelPermissions",
                              "package": "@wix/realtime-common"
                            }
                          ]
                        }
                      }
                    ]
                  },
                  {
                    "id": 53,
                    "name": "default",
                    "variant": "declaration",
                    "kind": 2048,
                    "flags": {},
                    "signatures": [
                      {
                        "id": 54,
                        "name": "default",
                        "variant": "signature",
                        "kind": 4096,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Sets the default permissions handler.\n\nThe default handler runs in the following cases:\n- When subscribing to a channel, when no explicit handler is set for that channel.\n- When subscribing to a resource, when no explicit handler is set for that resource or its parent channel.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
                            }
                          ],
                          "blockTags": [
                            {
                              "tag": "@requiredField",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "handler"
                                }
                              ]
                            },
                            {
                              "tag": "@servicePath",
                              "content": [
                                {
                                  "kind": "text",
                                  "text": "wix-realtime-backend.PermissionsRouter.PermissionsHandler"
                                }
                              ]
                            }
                          ]
                        },
                        "parameters": [
                          {
                            "id": 55,
                            "name": "handler",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Handler to run when checking default permissions."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 56,
                              "name": "PermissionsHandler",
                              "package": "@wix/sdk_realtime_site"
                            }
                          }
                        ],
                        "type": {
                          "type": "intrinsic",
                          "name": "void"
                        }
                      }
                    ]
                  }
                ],
                "groups": [
                  {
                    "title": "Methods",
                    "children": [
                      45,
                      49,
                      53
                    ]
                  }
                ]
              },
              {
                "id": 56,
                "name": "PermissionsHandler",
                "variant": "declaration",
                "kind": 2097152,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Determines the permissions for a subscriber on a channel or resource. Return a "
                    },
                    {
                      "kind": "code",
                      "text": "`ChannelPermissions`"
                    },
                    {
                      "kind": "text",
                      "text": " object to grant or deny access."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "channel"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.Channel"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "subscriber"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.Subscriber"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.ChannelPermissions"
                        }
                      ]
                    }
                  ]
                },
                "type": {
                  "type": "reflection",
                  "declaration": {
                    "id": 57,
                    "name": "__type",
                    "variant": "declaration",
                    "kind": 65536,
                    "flags": {},
                    "signatures": [
                      {
                        "id": 58,
                        "name": "__type",
                        "variant": "signature",
                        "kind": 4096,
                        "flags": {},
                        "parameters": [
                          {
                            "id": 59,
                            "name": "channel",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Channel or resource to check."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 61,
                              "name": "Channel",
                              "package": "@wix/realtime-common"
                            }
                          },
                          {
                            "id": 60,
                            "name": "subscriber",
                            "variant": "param",
                            "kind": 32768,
                            "flags": {},
                            "comment": {
                              "summary": [
                                {
                                  "kind": "text",
                                  "text": "Subscriber to check permissions for."
                                }
                              ]
                            },
                            "type": {
                              "type": "reference",
                              "target": 66,
                              "name": "Subscriber",
                              "package": "@wix/realtime-common"
                            }
                          }
                        ],
                        "type": {
                          "type": "union",
                          "types": [
                            {
                              "type": "reference",
                              "target": {
                                "packageName": "typescript",
                                "packagePath": "lib/lib.es5.d.ts",
                                "qualifiedName": "Promise"
                              },
                              "typeArguments": [
                                {
                                  "type": "reference",
                                  "target": 64,
                                  "name": "ChannelPermissions",
                                  "package": "@wix/realtime-common"
                                }
                              ],
                              "name": "Promise",
                              "package": "typescript"
                            },
                            {
                              "type": "reference",
                              "target": 64,
                              "name": "ChannelPermissions",
                              "package": "@wix/realtime-common"
                            }
                          ]
                        }
                      }
                    ]
                  }
                }
              },
              {
                "id": 33,
                "name": "add",
                "variant": "declaration",
                "kind": 64,
                "flags": {},
                "signatures": [
                  {
                    "id": 34,
                    "name": "add",
                    "variant": "signature",
                    "kind": 4096,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Sets a permissions handler for a specific channel or resource.\n\nAdding a handler to a channel without specifying a resource applies the handler to the channel and to any of its resources that don't have their own handlers. Learn more about [permission resolution](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
                        }
                      ],
                      "blockTags": [
                        {
                          "tag": "@requiredField",
                          "content": [
                            {
                              "kind": "text",
                              "text": "channel"
                            }
                          ]
                        },
                        {
                          "tag": "@servicePath",
                          "content": [
                            {
                              "kind": "text",
                              "text": "wix-realtime-backend.Channel"
                            }
                          ]
                        },
                        {
                          "tag": "@requiredField",
                          "content": [
                            {
                              "kind": "text",
                              "text": "handler"
                            }
                          ]
                        },
                        {
                          "tag": "@servicePath",
                          "content": [
                            {
                              "kind": "text",
                              "text": "wix-realtime-backend.PermissionsRouter.PermissionsHandler"
                            }
                          ]
                        }
                      ]
                    },
                    "parameters": [
                      {
                        "id": 35,
                        "name": "channel",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Channel or resource to set a permissions handler for."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 61,
                          "name": "Channel",
                          "package": "@wix/realtime-common"
                        }
                      },
                      {
                        "id": 36,
                        "name": "handler",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Handler to run when checking permissions for the specified channel."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 56,
                          "name": "PermissionsHandler",
                          "package": "@wix/sdk_realtime_site"
                        }
                      }
                    ],
                    "type": {
                      "type": "reference",
                      "target": {
                        "packageName": "typescript",
                        "packagePath": "lib/lib.es5.d.ts",
                        "qualifiedName": "Promise"
                      },
                      "typeArguments": [
                        {
                          "type": "intrinsic",
                          "name": "void"
                        }
                      ],
                      "name": "Promise",
                      "package": "typescript"
                    }
                  }
                ]
              },
              {
                "id": 37,
                "name": "check",
                "variant": "declaration",
                "kind": 64,
                "flags": {},
                "signatures": [
                  {
                    "id": 38,
                    "name": "check",
                    "variant": "signature",
                    "kind": 4096,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Checks permissions for a subscriber on a channel or resource.\n\nRuns the appropriate permissions handler to check whether the subscriber can receive messages on the specified channel or resource. Call this method in the body of the ["
                        },
                        {
                          "kind": "code",
                          "text": "`realtime_check_permission()`"
                        },
                        {
                          "kind": "text",
                          "text": "](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/realtime-check-permission) hook.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
                        }
                      ],
                      "blockTags": [
                        {
                          "tag": "@requiredField",
                          "content": [
                            {
                              "kind": "text",
                              "text": "channel"
                            }
                          ]
                        },
                        {
                          "tag": "@servicePath",
                          "content": [
                            {
                              "kind": "text",
                              "text": "wix-realtime-backend.Channel"
                            }
                          ]
                        },
                        {
                          "tag": "@requiredField",
                          "content": [
                            {
                              "kind": "text",
                              "text": "subscriber"
                            }
                          ]
                        },
                        {
                          "tag": "@servicePath",
                          "content": [
                            {
                              "kind": "text",
                              "text": "wix-realtime-backend.Subscriber"
                            }
                          ]
                        },
                        {
                          "tag": "@returns",
                          "content": [
                            {
                              "kind": "text",
                              "text": "Permissions granted to the subscriber for the specified channel or resource."
                            }
                          ]
                        },
                        {
                          "tag": "@servicePath",
                          "content": [
                            {
                              "kind": "text",
                              "text": "wix-realtime-backend.ChannelPermissions"
                            }
                          ]
                        }
                      ]
                    },
                    "parameters": [
                      {
                        "id": 39,
                        "name": "channel",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Channel or resource to check permissions for."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 61,
                          "name": "Channel",
                          "package": "@wix/realtime-common"
                        }
                      },
                      {
                        "id": 40,
                        "name": "subscriber",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Subscriber to check permissions for."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 66,
                          "name": "Subscriber",
                          "package": "@wix/realtime-common"
                        }
                      }
                    ],
                    "type": {
                      "type": "reference",
                      "target": {
                        "packageName": "typescript",
                        "packagePath": "lib/lib.es5.d.ts",
                        "qualifiedName": "Promise"
                      },
                      "typeArguments": [
                        {
                          "type": "reference",
                          "target": 64,
                          "name": "ChannelPermissions",
                          "package": "@wix/realtime-common"
                        }
                      ],
                      "name": "Promise",
                      "package": "typescript"
                    }
                  }
                ]
              },
              {
                "id": 41,
                "name": "default_reserved_word",
                "variant": "declaration",
                "kind": 64,
                "flags": {},
                "signatures": [
                  {
                    "id": 42,
                    "name": "default_reserved_word",
                    "variant": "signature",
                    "kind": 4096,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Sets the default permissions handler.\n\nThe default handler runs in the following cases:\n- When subscribing to a channel, when no explicit handler is set for that channel.\n- When subscribing to a resource, when no explicit handler is set for that resource or its parent channel.\n\nLearn more about [permission resolution](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#permission-resolution)."
                        }
                      ],
                      "blockTags": [
                        {
                          "tag": "@requiredField",
                          "content": [
                            {
                              "kind": "text",
                              "text": "handler"
                            }
                          ]
                        },
                        {
                          "tag": "@servicePath",
                          "content": [
                            {
                              "kind": "text",
                              "text": "wix-realtime-backend.PermissionsRouter.PermissionsHandler"
                            }
                          ]
                        }
                      ]
                    },
                    "parameters": [
                      {
                        "id": 43,
                        "name": "handler",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Default handler to run when checking permissions."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 56,
                          "name": "PermissionsHandler",
                          "package": "@wix/sdk_realtime_site"
                        }
                      }
                    ],
                    "type": {
                      "type": "intrinsic",
                      "name": "void"
                    }
                  }
                ]
              }
            ],
            "groups": [
              {
                "title": "Interfaces",
                "children": [
                  44
                ]
              },
              {
                "title": "Type Aliases",
                "children": [
                  56
                ]
              },
              {
                "title": "Functions",
                "children": [
                  33,
                  37,
                  41
                ]
              }
            ]
          },
          {
            "id": 61,
            "name": "Channel",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Realtime broadcast channel. Publishers send messages to channels and subscribers listen to them."
                }
              ]
            },
            "children": [
              {
                "id": 62,
                "name": "name",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Channel name.\n\n> **Notes:**\n> - Supports only alphanumeric characters, hyphens, and underscores.\n> - The combined length of "
                    },
                    {
                      "kind": "code",
                      "text": "`name`"
                    },
                    {
                      "kind": "text",
                      "text": " and "
                    },
                    {
                      "kind": "code",
                      "text": "`resourceId`"
                    },
                    {
                      "kind": "text",
                      "text": " can't exceed 140 characters."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              },
              {
                "id": 63,
                "name": "resourceId",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Resource ID.\n\nResources are independent sub-channels in a channel. A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  62,
                  63
                ]
              }
            ]
          },
          {
            "id": 64,
            "name": "ChannelPermissions",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Permissions for a subscriber on a channel or resource."
                }
              ]
            },
            "children": [
              {
                "id": 65,
                "name": "read",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Whether the subscriber can receive messages on the channel.\n\nDefault: "
                    },
                    {
                      "kind": "code",
                      "text": "`true`"
                    },
                    {
                      "kind": "text",
                      "text": "."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "boolean"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  65
                ]
              }
            ]
          },
          {
            "id": 69,
            "name": "PublishOptions",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "An object containing options for publishing."
                }
              ]
            },
            "children": [
              {
                "id": 71,
                "name": "includePublisher",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Whether to include information about the message publisher.\nDefaults to "
                    },
                    {
                      "kind": "code",
                      "text": "`false`"
                    },
                    {
                      "kind": "text",
                      "text": "."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "boolean"
                }
              },
              {
                "id": 70,
                "name": "users",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "User IDs of specific users to publish to."
                    }
                  ]
                },
                "type": {
                  "type": "array",
                  "elementType": {
                    "type": "intrinsic",
                    "name": "string"
                  }
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  71,
                  70
                ]
              }
            ]
          },
          {
            "id": 66,
            "name": "Subscriber",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Subscriber to a channel or resource.\n\nWix checks [subscriber permissions](https://dev.wix.com/docs/sdk/business-solutions/realtime/realtime/site/realtime-check-permission) before they can listen to messages."
                }
              ]
            },
            "children": [
              {
                "id": 67,
                "name": "id",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Subscriber ID."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "id"
                        }
                      ]
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              },
              {
                "id": 68,
                "name": "type",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Subscriber identity type.\n\nLearn more about [Wix identities](https://dev.wix.com/docs/build-apps/develop-your-app/access/about-identities)."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "type"
                        }
                      ]
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": {
                    "packageName": "@wix/realtime-common",
                    "packagePath": "cjs/build/types.d.ts",
                    "qualifiedName": "SubscriberType"
                  },
                  "name": "SubscriberType",
                  "package": "@wix/realtime-common"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  67,
                  68
                ]
              }
            ]
          },
          {
            "id": 11,
            "name": "permissionsRouter",
            "variant": "declaration",
            "kind": 2097152,
            "flags": {
              "isReadonly": true
            },
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Realtime permissions router.\n\nDefines which subscribers can receive messages on specific channels or resources. Learn more about the [permissions router](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction)."
                }
              ],
              "blockTags": [
                {
                  "tag": "@servicePath",
                  "content": [
                    {
                      "kind": "text",
                      "text": "wix-realtime-backend.PermissionsRouter"
                    }
                  ]
                }
              ]
            },
            "type": {
              "type": "reference",
              "target": 44,
              "name": "PermissionsRouter",
              "package": "@wix/sdk_realtime_site"
            }
          },
          {
            "id": 2,
            "name": "publish",
            "variant": "declaration",
            "kind": 64,
            "flags": {},
            "signatures": [
              {
                "id": 3,
                "name": "publish",
                "variant": "signature",
                "kind": 4096,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Publishes a message to a channel or resource.\n\nSubscribers to a channel don't receive messages published to a resource on\nthat channel, and vice versa.\n\nTo publish a message to specific users only, specify the users by ID in\nthe "
                    },
                    {
                      "kind": "code",
                      "text": "`options`"
                    },
                    {
                      "kind": "text",
                      "text": " parameter. To include the publisher's identity in the message,\nset "
                    },
                    {
                      "kind": "code",
                      "text": "`includePublisher`"
                    },
                    {
                      "kind": "text",
                      "text": " to "
                    },
                    {
                      "kind": "code",
                      "text": "`true`"
                    },
                    {
                      "kind": "text",
                      "text": " in the "
                    },
                    {
                      "kind": "code",
                      "text": "`options`"
                    },
                    {
                      "kind": "text",
                      "text": " parameter."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@deprecated",
                      "content": [
                        {
                          "kind": "text",
                          "text": "Use "
                        },
                        {
                          "kind": "code",
                          "text": "`publisher.publish()`"
                        },
                        {
                          "kind": "text",
                          "text": " from the "
                        },
                        {
                          "kind": "code",
                          "text": "`@wix/realtime`"
                        },
                        {
                          "kind": "text",
                          "text": " module instead."
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "channel"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.Channel"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "payload"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.PublishOptions"
                        }
                      ]
                    },
                    {
                      "tag": "@returns",
                      "content": [
                        {
                          "kind": "text",
                          "text": "Resolves when the message is published. Doesn't indicate that the message was received by subscribers."
                        }
                      ]
                    }
                  ]
                },
                "parameters": [
                  {
                    "id": 4,
                    "name": "channel",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Channel, and optionally resource, to publish to."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 61,
                      "name": "Channel",
                      "package": "@wix/realtime-common"
                    }
                  },
                  {
                    "id": 5,
                    "name": "payload",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Message payload. Max: 10 KB."
                        }
                      ]
                    },
                    "type": {
                      "type": "intrinsic",
                      "name": "any"
                    }
                  },
                  {
                    "id": 6,
                    "name": "options",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {
                      "isOptional": true
                    },
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Options for publishing, such as targeting specific users."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 69,
                      "name": "PublishOptions",
                      "package": "@wix/sdk_realtime_site"
                    }
                  }
                ],
                "type": {
                  "type": "reference",
                  "target": {
                    "packageName": "typescript",
                    "packagePath": "lib/lib.es5.d.ts",
                    "qualifiedName": "Promise"
                  },
                  "typeArguments": [
                    {
                      "type": "intrinsic",
                      "name": "void"
                    }
                  ],
                  "name": "Promise",
                  "package": "typescript"
                }
              }
            ]
          },
          {
            "id": 7,
            "name": "realtime_check_permission",
            "variant": "declaration",
            "kind": 64,
            "flags": {},
            "signatures": [
              {
                "id": 8,
                "name": "realtime_check_permission",
                "variant": "signature",
                "kind": 4096,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Checks permissions for a subscriber on a channel or resource.\n\nSet up this hook as a named export in the "
                    },
                    {
                      "kind": "code",
                      "text": "`realtime-permissions.js`"
                    },
                    {
                      "kind": "text",
                      "text": " file in a site's backend. The hook runs automatically whenever a new subscription is attempted, including [re-subscriptions after reconnection](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction#core-modules_realtime_realtime_subscriber_reconnection-and-message-sync). Permissions are checked once per subscription attempt. Changes to permissions don't affect active subscriptions until the subscriber reconnects.\n\nCall ["
                    },
                    {
                      "kind": "code",
                      "text": "`check()`"
                    },
                    {
                      "kind": "text",
                      "text": "](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/check) in the body of this hook to use the [Permissions Router](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction) to organize permissions logic. Alternatively, you can also include permissions logic directly in the hook body.\n\nLearn more about [setting up permissions](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction#setting-up-permissions)."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "channel"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.Channel"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "subscriber"
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.Subscriber"
                        }
                      ]
                    },
                    {
                      "tag": "@returns",
                      "content": [
                        {
                          "kind": "text",
                          "text": "Permissions granted to the subscriber for the specified channel or resource."
                        }
                      ]
                    },
                    {
                      "tag": "@servicePath",
                      "content": [
                        {
                          "kind": "text",
                          "text": "wix-realtime-backend.ChannelPermissions"
                        }
                      ]
                    }
                  ]
                },
                "parameters": [
                  {
                    "id": 9,
                    "name": "channel",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Channel and resource to check permissions for."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 61,
                      "name": "Channel",
                      "package": "@wix/realtime-common"
                    }
                  },
                  {
                    "id": 10,
                    "name": "subscriber",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Subscriber to check permissions for."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 66,
                      "name": "Subscriber",
                      "package": "@wix/realtime-common"
                    }
                  }
                ],
                "type": {
                  "type": "reference",
                  "target": {
                    "packageName": "typescript",
                    "packagePath": "lib/lib.es5.d.ts",
                    "qualifiedName": "Promise"
                  },
                  "typeArguments": [
                    {
                      "type": "reference",
                      "target": 64,
                      "name": "ChannelPermissions",
                      "package": "@wix/realtime-common"
                    }
                  ],
                  "name": "Promise",
                  "package": "typescript"
                }
              }
            ]
          }
        ],
        "groups": [
          {
            "title": "Namespaces",
            "children": [
              32
            ]
          },
          {
            "title": "Interfaces",
            "children": [
              61,
              64,
              69,
              66
            ]
          },
          {
            "title": "Type Aliases",
            "children": [
              11
            ]
          },
          {
            "title": "Functions",
            "children": [
              2,
              7
            ]
          }
        ]
      },
      {
        "id": 19,
        "name": "subscriber",
        "variant": "declaration",
        "kind": 4,
        "flags": {},
        "children": [
          {
            "id": 110,
            "name": "RealtimeErrorCode",
            "variant": "declaration",
            "kind": 8,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Error codes."
                }
              ]
            },
            "children": [
              {
                "id": 114,
                "name": "BadInput",
                "variant": "declaration",
                "kind": 16,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Invalid input such as a channel name with unsupported characters."
                    }
                  ]
                },
                "type": {
                  "type": "literal",
                  "value": "BAD_INPUT"
                }
              },
              {
                "id": 112,
                "name": "ConnectionError",
                "variant": "declaration",
                "kind": 16,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Connection attempt failed. Wix automatically attempts to establish the subscription."
                    }
                  ]
                },
                "type": {
                  "type": "literal",
                  "value": "CONNECTION_ERROR"
                }
              },
              {
                "id": 111,
                "name": "Disconnected",
                "variant": "declaration",
                "kind": 16,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Connection closed intentionally or due to an error. Check "
                    },
                    {
                      "kind": "code",
                      "text": "`error.recoverable`"
                    },
                    {
                      "kind": "text",
                      "text": " to determine whether the client is attempting to reconnect."
                    }
                  ]
                },
                "type": {
                  "type": "literal",
                  "value": "DISCONNECTED"
                }
              },
              {
                "id": 113,
                "name": "SubscriptionFailed",
                "variant": "declaration",
                "kind": 16,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Subscription request rejected, for example, due to an authorization failure. This error is non-recoverable."
                    }
                  ]
                },
                "type": {
                  "type": "literal",
                  "value": "SUBSCRIPTION_FAILED"
                }
              }
            ],
            "groups": [
              {
                "title": "Enumeration Members",
                "children": [
                  114,
                  112,
                  111,
                  113
                ]
              }
            ]
          },
          {
            "id": 79,
            "name": "Message",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Message received on a channel."
                }
              ]
            },
            "children": [
              {
                "id": 80,
                "name": "payload",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Message payload that contains the published data.\n\nMax: 10 KB."
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": {
                    "packageName": "typescript",
                    "packagePath": "lib/lib.es5.d.ts",
                    "qualifiedName": "Record"
                  },
                  "typeArguments": [
                    {
                      "type": "intrinsic",
                      "name": "string"
                    },
                    {
                      "type": "intrinsic",
                      "name": "any"
                    }
                  ],
                  "name": "Record",
                  "package": "typescript"
                }
              },
              {
                "id": 81,
                "name": "publisher",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Publisher details.\n\nReturned only when the publisher's identity is available."
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": 87,
                  "name": "Publisher",
                  "package": "@wix/realtime-common"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  80,
                  81
                ]
              }
            ]
          },
          {
            "id": 87,
            "name": "Publisher",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Publisher details."
                }
              ]
            },
            "children": [
              {
                "id": 88,
                "name": "id",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Publisher ID."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  88
                ]
              }
            ]
          },
          {
            "id": 105,
            "name": "RealtimeError",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Error thrown by a subscription or connection."
                }
              ]
            },
            "children": [
              {
                "id": 107,
                "name": "channel",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Channel that caused the error."
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": 75,
                  "name": "SubscribeChannel",
                  "package": "@wix/realtime-common"
                }
              },
              {
                "id": 106,
                "name": "errorCode",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Error code."
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": 110,
                  "name": "RealtimeErrorCode",
                  "package": "@wix/realtime-common"
                }
              },
              {
                "id": 108,
                "name": "recoverable",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Whether the error is automatically recoverable.\n\nWhen "
                    },
                    {
                      "kind": "code",
                      "text": "`true`"
                    },
                    {
                      "kind": "text",
                      "text": ", the client automatically attempts to reconnect. When "
                    },
                    {
                      "kind": "code",
                      "text": "`false`"
                    },
                    {
                      "kind": "text",
                      "text": ", you must attempt to re-subscribe manually.\n\nDefault: "
                    },
                    {
                      "kind": "code",
                      "text": "`false`"
                    },
                    {
                      "kind": "text",
                      "text": "."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "boolean"
                }
              },
              {
                "id": 109,
                "name": "status",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "[HTTP status code](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/troubleshooting/about-errors#http-status-codes).\n\nReturned only when "
                    },
                    {
                      "kind": "code",
                      "text": "`errorCode`"
                    },
                    {
                      "kind": "text",
                      "text": " is "
                    },
                    {
                      "kind": "code",
                      "text": "`SUBSCRIPTION_FAILED`"
                    },
                    {
                      "kind": "text",
                      "text": "."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "number"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  107,
                  106,
                  108,
                  109
                ]
              }
            ],
            "extendedTypes": [
              {
                "type": "reference",
                "target": {
                  "packageName": "typescript",
                  "packagePath": "lib/lib.es5.d.ts",
                  "qualifiedName": "Error"
                },
                "name": "Error",
                "package": "typescript"
              }
            ]
          },
          {
            "id": 75,
            "name": "SubscribeChannel",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Realtime broadcast subscribed channel. Subscribers listen to messages published to channels."
                }
              ]
            },
            "children": [
              {
                "id": 78,
                "name": "appId",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "ID of the app that manages the channel you want to subscribe to.\n\nUse this field for [cross-app subscriptions](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions) only.\nIn other cases, leave this field empty to subscribe to channels managed by the current app or by the site's backend code.\n\n> **Note**: The app that manages the channel must implement the [Realtime Permissions Provider](https://dev.wix.com/docs/sdk/core-modules/realtime/extensions/realtime-permissions-provider/introduction) service plugin to authorize cross-app subscriptions."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              },
              {
                "id": 76,
                "name": "name",
                "variant": "declaration",
                "kind": 1024,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Channel name.\n\n> **Notes:**\n> - Supports only alphanumeric characters, hyphens, and underscores.\n> - The combined length of "
                    },
                    {
                      "kind": "code",
                      "text": "`name`"
                    },
                    {
                      "kind": "text",
                      "text": " and "
                    },
                    {
                      "kind": "code",
                      "text": "`resourceId`"
                    },
                    {
                      "kind": "text",
                      "text": " can't exceed 140 characters."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              },
              {
                "id": 77,
                "name": "resourceId",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Resource ID.\n\nResources are independent sub-channels in a channel. A subscriber listening to a resource doesn't receive messages published to the parent channel, and vice versa."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  78,
                  76,
                  77
                ]
              }
            ]
          },
          {
            "id": 99,
            "name": "SubscriptionOptions",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Subscription status handlers that run whenever a subscription is established, re-established, or fails."
                }
              ]
            },
            "children": [
              {
                "id": 100,
                "name": "onSubscribed",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Runs whenever the subscription is successfully established or re-established after a prior failure. To avoid unnecessary actions, make the handler idempotent.\n\nThe "
                    },
                    {
                      "kind": "code",
                      "text": "`isSynced`"
                    },
                    {
                      "kind": "text",
                      "text": " parameter indicates whether missed messages were restored."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@param",
                      "name": "subscriptionId",
                      "content": [
                        {
                          "kind": "text",
                          "text": "ID of the subscription."
                        }
                      ]
                    },
                    {
                      "tag": "@param",
                      "name": "isSynced",
                      "content": [
                        {
                          "kind": "text",
                          "text": "Whether the server successfully restored missed messages since the last disconnection.\n\nThe value of this parameter depends on the scenario:\n\n- When subscribing for the first time, "
                        },
                        {
                          "kind": "code",
                          "text": "`isSynced`"
                        },
                        {
                          "kind": "text",
                          "text": " is "
                        },
                        {
                          "kind": "code",
                          "text": "`false`"
                        },
                        {
                          "kind": "text",
                          "text": ", as there are no prior messages to restore. In this scenario, load your initial state independently.\n\n- When re-subscribing and all messages were successfully restored, "
                        },
                        {
                          "kind": "code",
                          "text": "`isSynced`"
                        },
                        {
                          "kind": "text",
                          "text": " is "
                        },
                        {
                          "kind": "code",
                          "text": "`true`"
                        },
                        {
                          "kind": "text",
                          "text": ". No further action is necessary.\n\n- When re-subscribing but some messages weren't restored, "
                        },
                        {
                          "kind": "code",
                          "text": "`isSynced`"
                        },
                        {
                          "kind": "text",
                          "text": " is "
                        },
                        {
                          "kind": "code",
                          "text": "`false`"
                        },
                        {
                          "kind": "text",
                          "text": ". The server is unable to restore all missed messages. In this scenario, you need to resync your state independently.\n\n<!-- TODO: Document server-side buffer limits for message replay. -->"
                        }
                      ]
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": 89,
                  "name": "SubscriptionHandler",
                  "package": "@wix/realtime-common"
                }
              },
              {
                "id": 101,
                "name": "onSubscriptionError",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Runs when a subscription error occurs. It can run multiple times in a single session.\n\nThis handler runs in the following scenarios:\n\n- **Subscription failed**: The subscription request was rejected, for example, due to an authorization failure. This error is non-recoverable, so the subscription isn't automatically re-attempted.\n\n- **Subscription disconnected**: The connection between the subscriber and publisher was closed. Check "
                    },
                    {
                      "kind": "code",
                      "text": "`error.recoverable`"
                    },
                    {
                      "kind": "text",
                      "text": ":\n   - When "
                    },
                    {
                      "kind": "code",
                      "text": "`true`"
                    },
                    {
                      "kind": "text",
                      "text": ", the error is recoverable. The subscription is automatically re-attempted. No further action necessary.\n   - When "
                    },
                    {
                      "kind": "code",
                      "text": "`false`"
                    },
                    {
                      "kind": "text",
                      "text": ", the error isn't recoverable. Establish the subscription again.\n\n- **Connection error**: Runs on each failed subscription attempt. The "
                    },
                    {
                      "kind": "code",
                      "text": "`error.recoverable`"
                    },
                    {
                      "kind": "text",
                      "text": " flag is always "
                    },
                    {
                      "kind": "code",
                      "text": "`true`"
                    },
                    {
                      "kind": "text",
                      "text": ", as the subscription is re-established."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@param",
                      "name": "error",
                      "content": [
                        {
                          "kind": "text",
                          "text": "Error that occurred. Check "
                        },
                        {
                          "kind": "code",
                          "text": "`errorCode`"
                        },
                        {
                          "kind": "text",
                          "text": " and "
                        },
                        {
                          "kind": "code",
                          "text": "`recoverable`"
                        },
                        {
                          "kind": "text",
                          "text": " to determine the type and whether manual action is required."
                        }
                      ]
                    },
                    {
                      "tag": "@param",
                      "name": "subscriptionId",
                      "content": [
                        {
                          "kind": "text",
                          "text": "ID of the subscription that generated the error."
                        }
                      ]
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": 94,
                  "name": "SubscriptionErrorHandler",
                  "package": "@wix/realtime-common"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  100,
                  101
                ]
              }
            ]
          },
          {
            "id": 102,
            "name": "UnsubscribeOptions",
            "variant": "declaration",
            "kind": 256,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Unsubscribe options. Specify "
                },
                {
                  "kind": "code",
                  "text": "`channel`"
                },
                {
                  "kind": "text",
                  "text": ", "
                },
                {
                  "kind": "code",
                  "text": "`subscriptionId`"
                },
                {
                  "kind": "text",
                  "text": ", or both:\n\n- To remove all subscriptions from a channel, specify the channel in "
                },
                {
                  "kind": "code",
                  "text": "`channel.name`"
                },
                {
                  "kind": "text",
                  "text": ".\n- To remove a single subscription, specify the "
                },
                {
                  "kind": "code",
                  "text": "`subscriptionId`"
                },
                {
                  "kind": "text",
                  "text": ".\n- To remove a single subscription with channel verification, specify both. This removes the specified subscription only if it listens to the specified channel."
                }
              ]
            },
            "children": [
              {
                "id": 103,
                "name": "channel",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Channel or resource to unsubscribe from.\n\nWhen empty, the subscription is removed without verifying that it belongs to the channel."
                    }
                  ]
                },
                "type": {
                  "type": "reference",
                  "target": 75,
                  "name": "SubscribeChannel",
                  "package": "@wix/realtime-common"
                }
              },
              {
                "id": 104,
                "name": "subscriptionId",
                "variant": "declaration",
                "kind": 1024,
                "flags": {
                  "isOptional": true
                },
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "ID of the subscription to remove.\n\nWhen empty, all subscriptions to the specified channel are removed."
                    }
                  ]
                },
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              }
            ],
            "groups": [
              {
                "title": "Properties",
                "children": [
                  103,
                  104
                ]
              }
            ]
          },
          {
            "id": 82,
            "name": "MessageHandler",
            "variant": "declaration",
            "kind": 2097152,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Runs when a message is published to a channel or resource the subscriber listens to."
                }
              ]
            },
            "type": {
              "type": "reflection",
              "declaration": {
                "id": 83,
                "name": "__type",
                "variant": "declaration",
                "kind": 65536,
                "flags": {},
                "signatures": [
                  {
                    "id": 84,
                    "name": "__type",
                    "variant": "signature",
                    "kind": 4096,
                    "flags": {},
                    "parameters": [
                      {
                        "id": 85,
                        "name": "message",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Published message."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 79,
                          "name": "Message",
                          "package": "@wix/realtime-common"
                        }
                      },
                      {
                        "id": 86,
                        "name": "channel",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Channel the message was published to."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 75,
                          "name": "SubscribeChannel",
                          "package": "@wix/realtime-common"
                        }
                      }
                    ],
                    "type": {
                      "type": "intrinsic",
                      "name": "void"
                    }
                  }
                ]
              }
            }
          },
          {
            "id": 94,
            "name": "SubscriptionErrorHandler",
            "variant": "declaration",
            "kind": 2097152,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Runs when a subscription error occurs."
                }
              ]
            },
            "type": {
              "type": "reflection",
              "declaration": {
                "id": 95,
                "name": "__type",
                "variant": "declaration",
                "kind": 65536,
                "flags": {},
                "signatures": [
                  {
                    "id": 96,
                    "name": "__type",
                    "variant": "signature",
                    "kind": 4096,
                    "flags": {},
                    "parameters": [
                      {
                        "id": 97,
                        "name": "error",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Error that occurred."
                            }
                          ]
                        },
                        "type": {
                          "type": "reference",
                          "target": 105,
                          "name": "RealtimeError",
                          "package": "@wix/realtime-common"
                        }
                      },
                      {
                        "id": 98,
                        "name": "subscriptionId",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "ID of the subscription that generated the error."
                            }
                          ]
                        },
                        "type": {
                          "type": "intrinsic",
                          "name": "string"
                        }
                      }
                    ],
                    "type": {
                      "type": "intrinsic",
                      "name": "void"
                    }
                  }
                ]
              }
            }
          },
          {
            "id": 89,
            "name": "SubscriptionHandler",
            "variant": "declaration",
            "kind": 2097152,
            "flags": {},
            "comment": {
              "summary": [
                {
                  "kind": "text",
                  "text": "Runs when a subscription is successfully established or re-established.\n\nWhen a subscription fails and is re-established, the subscriber might not receive all messages published during the failure. The "
                },
                {
                  "kind": "code",
                  "text": "`isSynced`"
                },
                {
                  "kind": "text",
                  "text": " flag indicates whether all missed messages were successfully delivered.\n\n<!-- TODO: Document server-side buffer limits for message replay. -->"
                }
              ]
            },
            "type": {
              "type": "reflection",
              "declaration": {
                "id": 90,
                "name": "__type",
                "variant": "declaration",
                "kind": 65536,
                "flags": {},
                "signatures": [
                  {
                    "id": 91,
                    "name": "__type",
                    "variant": "signature",
                    "kind": 4096,
                    "flags": {},
                    "parameters": [
                      {
                        "id": 92,
                        "name": "subscriptionId",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Subscription ID."
                            }
                          ]
                        },
                        "type": {
                          "type": "intrinsic",
                          "name": "string"
                        }
                      },
                      {
                        "id": 93,
                        "name": "isSynced",
                        "variant": "param",
                        "kind": 32768,
                        "flags": {},
                        "comment": {
                          "summary": [
                            {
                              "kind": "text",
                              "text": "Whether the message history was fully restored."
                            }
                          ]
                        },
                        "type": {
                          "type": "intrinsic",
                          "name": "boolean"
                        }
                      }
                    ],
                    "type": {
                      "type": "intrinsic",
                      "name": "void"
                    }
                  }
                ]
              }
            }
          },
          {
            "id": 20,
            "name": "subscribe",
            "variant": "declaration",
            "kind": 64,
            "flags": {},
            "signatures": [
              {
                "id": 21,
                "name": "subscribe",
                "variant": "signature",
                "kind": 4096,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Subscribes to a channel or resource.\n\nThe method attempts to establish a subscription to the specified channel or resource. It returns the subscription ID immediately while the subscription is attempted in the background.\n\nUse the "
                    },
                    {
                      "kind": "code",
                      "text": "`options`"
                    },
                    {
                      "kind": "text",
                      "text": " parameter to register handlers that run whenever the subscription succeeds or generates an error. For some errors, the subscription is re-attempted automatically. The "
                    },
                    {
                      "kind": "code",
                      "text": "`onSubscribed()`"
                    },
                    {
                      "kind": "text",
                      "text": " handler runs on every successful re-subscription.\n\nLearn more about the [subscription lifecycle](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction#core-modules_realtime_realtime_subscriber_subscription-lifecycle)."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@example",
                      "name": "Subscribe to a channel",
                      "content": [
                        {
                          "kind": "code",
                          "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nconst subscriptionId = subscriber.subscribe(\n  { name: 'my-channel' },\n  (message, channel) => {\n    console.log('Received:', message.payload);\n  },\n);\n```"
                        }
                      ]
                    },
                    {
                      "tag": "@example",
                      "name": "Subscribe to a channel: Self-hosted",
                      "content": [
                        {
                          "kind": "code",
                          "text": "```ts\nimport { createClient } from '@wix/sdk';\nimport { subscriber } from '@wix/realtime';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n  modules: { subscriber },\n  // Include the auth strategy and host as relevant\n});\n\nconst subscriptionId = client.subscriber.subscribe(\n  { name: 'my-channel' },\n  (message, channel) => {\n    console.log('Received:', message.payload);\n  },\n  {\n    onSubscribed: (id, isSynced) => console.log('Subscribed', id),\n    onSubscriptionError: (error, id) => console.error('Error', error),\n  },\n);\n```"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "channel"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "messageHandler"
                        }
                      ]
                    }
                  ]
                },
                "parameters": [
                  {
                    "id": 22,
                    "name": "channel",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Channel and resource to subscribe to."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 75,
                      "name": "SubscribeChannel",
                      "package": "@wix/realtime-common"
                    }
                  },
                  {
                    "id": 23,
                    "name": "messageHandler",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Handler that runs whenever a message is published to the channel or resource."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 82,
                      "name": "MessageHandler",
                      "package": "@wix/realtime-common"
                    }
                  },
                  {
                    "id": 24,
                    "name": "options",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {
                      "isOptional": true
                    },
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "[Lifecycle handlers](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction#core-modules_realtime_realtime_subscriber_subscription-lifecycle) for subscription events."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 99,
                      "name": "SubscriptionOptions",
                      "package": "@wix/realtime-common"
                    }
                  }
                ],
                "type": {
                  "type": "intrinsic",
                  "name": "string"
                }
              }
            ]
          },
          {
            "id": 27,
            "name": "unsubscribe",
            "variant": "declaration",
            "kind": 64,
            "flags": {},
            "signatures": [
              {
                "id": 28,
                "name": "unsubscribe",
                "variant": "signature",
                "kind": 4096,
                "flags": {},
                "comment": {
                  "summary": [
                    {
                      "kind": "text",
                      "text": "Removes 1 or more subscriptions.\n\nYou can unsubscribe in 3 ways:\n- By "
                    },
                    {
                      "kind": "code",
                      "text": "`subscriptionId`"
                    },
                    {
                      "kind": "text",
                      "text": ": removes a single subscription.\n- By "
                    },
                    {
                      "kind": "code",
                      "text": "`channel`"
                    },
                    {
                      "kind": "text",
                      "text": ": removes all subscriptions to that channel or resource.\n- By both: removes the specific subscription, verifying it matches the channel.\n\nWhen the last subscription on a connection is removed, the connection\ncloses automatically."
                    }
                  ],
                  "blockTags": [
                    {
                      "tag": "@example",
                      "name": "Remove the specified subscription.",
                      "content": [
                        {
                          "kind": "code",
                          "text": "```ts\nimport { subscriber } from '@wix/realtime';\n\nsubscriber.unsubscribe({ subscriptionId });\n```"
                        }
                      ]
                    },
                    {
                      "tag": "@example",
                      "name": "Remove the specified subscription: Self-hosted",
                      "content": [
                        {
                          "kind": "code",
                          "text": "```ts\nimport { subscriber } from '@wix/realtime';\nimport { createClient } from '@wix/sdk';\n\n// Import the auth strategy for the relevant access type\n// Import the relevant host module if needed\n\nconst client = createClient({\n  modules: { subscriber },\n  // Include the auth strategy and host as relevant\n});\n\n// Remove the specified subscription\nclient.subscriber.unsubscribe({ subscriptionId });\n\n// Remove all subscriptions from the specified channel\nclient.subscriber.unsubscribe({ channel: { name: 'my-channel' } });\n```"
                        }
                      ]
                    },
                    {
                      "tag": "@requiredField",
                      "content": [
                        {
                          "kind": "text",
                          "text": "options"
                        }
                      ]
                    }
                  ]
                },
                "parameters": [
                  {
                    "id": 29,
                    "name": "options",
                    "variant": "param",
                    "kind": 32768,
                    "flags": {},
                    "comment": {
                      "summary": [
                        {
                          "kind": "text",
                          "text": "Unsubscribe details. You must specify "
                        },
                        {
                          "kind": "code",
                          "text": "`channel`"
                        },
                        {
                          "kind": "text",
                          "text": ", "
                        },
                        {
                          "kind": "code",
                          "text": "`subscriptionId`"
                        },
                        {
                          "kind": "text",
                          "text": ", or both."
                        }
                      ]
                    },
                    "type": {
                      "type": "reference",
                      "target": 102,
                      "name": "UnsubscribeOptions",
                      "package": "@wix/realtime-common"
                    }
                  }
                ],
                "type": {
                  "type": "intrinsic",
                  "name": "void"
                }
              }
            ]
          }
        ],
        "groups": [
          {
            "title": "Enumerations",
            "children": [
              110
            ]
          },
          {
            "title": "Interfaces",
            "children": [
              79,
              87,
              105,
              75,
              99,
              102
            ]
          },
          {
            "title": "Type Aliases",
            "children": [
              82,
              94,
              89
            ]
          },
          {
            "title": "Functions",
            "children": [
              20,
              27
            ]
          }
        ]
      }
    ],
    "groups": [
      {
        "title": "Namespaces",
        "children": [
          12,
          1,
          19
        ]
      }
    ],
    "packageName": "@wix/realtime",
    "symbolIdMap": {},
    "files": {
      "entries": {
        "1": "src/doc-types/index.ts",
        "2": "../site/src/doc-types/index.ts",
        "3": "src/publisher/publisher.context.ts",
        "4": "src/subscriber/subscriber.context.ts",
        "5": "../site/src/doc-types/src/permissionsrouter.ts"
      },
      "reflections": {
        "1": 0,
        "2": 1,
        "3": 12,
        "4": 19,
        "5": 32
      }
    }
  },
  "appendices": {
    "/publisher": [
      {
        "type": "GUIDE",
        "title": "Introduction",
        "src": "---\narticleType: intro\n---\n\n# About the Publisher API\n\nThe Publisher API is a backend module for sending messages to [channels and resources](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources). Subscribers with suitable permissions receive these messages instantly. Channels and resources are independent, so messages sent to a channel aren't delivered to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n\nWith the Publisher API, you can:\n\n- Publish messages to a channel or resource.\n\n<!-- TODO check that elevation note appears in method description -->\n<!-- TODO: Check whether this API is relevant for headless projects. -->\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- Messages don't persist across tab sessions. Closing the browser tab or window closes the connection.\n- Messages aren't queued. When no subscribers are listening, the message is dropped.\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## See also\n\n- [Subscriber API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction)\n\n@sdk_package_setup\n"
      },
      {
        "type": "GUIDE",
        "title": "Setup",
        "src": "# Setup\n\n@package_metadata:@wix/realtime\n\nTo use the Realtime API, install the `@wix/realtime` package.\n\n#### Install the package\n\nFollow the installation instructions for your development environment.\n\n| Development environment   | Installation method                                                                                                                                                         |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor).                               |\n| Wix sites (local IDE)     | Run `wix install @wix/realtime` using the [Wix CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli). |\n| CLI and self-managed apps | Run `npm install @wix/realtime` or `yarn add @wix/realtime`. |\n| Headless sites and apps | Run `npm install @wix/realtime` or `yarn add @wix/realtime`.|\n\n#### Import the package\n\nTo import the package in your code:\n\n```js\nimport { publisher } from '@wix/realtime';\n```\n"
      }
    ],
    "/subscriber": [
      {
        "type": "GUIDE",
        "title": "Introduction",
        "src": "---\narticleType: intro\n---\n\n# About the Subscriber API\n\nThe Subscriber API lets clients subscribe to [channels and resources](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources) to receive messages in real time. Subscribers with suitable permissions instantly receive messages sent by a publisher. Channels and resources are independent, so messages sent to a channel aren't delivered to a resource, and vice versa.\n\nLearn more [about the Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n\nWith the Subscriber API, you can:\n\n- Subscribe or unsubscribe from a channel or resource.\n- Respond to subscription successes, connection errors, and incoming messages with dedicated handlers.\n\n## Subscription lifecycle\n\nThe `subscribe()` method returns a subscription ID immediately, but the connection is established in the background. Subscribers can use the subscription ID to [unsubscribe](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/unsubscribe) at a later time.\n\nYou can register lifecycle handlers to respond when the subscription succeeds or fails:\n\n- The [`onSubscribed` handler](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/subscribe) runs on every successful connection, including [automatic re-connections](#reconnection-and-message-sync) attempted after network interruptions.\n- The [`onSubscriptionError` handler](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/subscribe) runs whenever an [error occurs](#subscription-errors).\n\n### Reconnection and message sync\n\nIf the connection drops, the client automatically attempts to reconnect and re-subscribe. When subscribing or re-subscribing, the `isSynced` parameter of the `onSubscribed()` handler indicates whether all missed messages were successfully restored, or whether the subscriber needs to take further action.\n\nLearn more about [subscribing](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/subscribe) to a channel or resource.\n\n<!-- TODO: Document backend buffer limits for message replay. -->\n\n### Subscription errors\n\nSubscription errors occur when a subscription is rejected or when the connection fails. Each error includes `errorCode` and `recoverable` parameters that indicate the error type and whether the client is automatically trying to reconnect.\n\nLearn more about how the [`subscribe()`](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/subscribe) method handles subscription errors.\n\n## Unsubscribing\n\nYou can unsubscribe in the following ways:\n\n- By `subscriptionId`: Removes a single subscription.\n<!-- TODO: Confirm with dev that unsubscribing by channel doesn't affect resource subscriptions, and vice versa. Item 2.13-->\n- By `channel`: Removes all subscriptions that match the specified channel and resource exactly. Unsubscribing from a channel doesn't affect subscriptions to resources on that channel, and vice versa.\n- By both: Removes the specific subscription, verifying it matches the specified channel or resource. If it doesn't, the subscription isn't removed.\n\nWhen the last subscription on a connection is removed, the connection closes automatically.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- The Realtime SDK checks permissions when a subscription is first established. When a subscriber doesn't have `read` permission on the channel, the subscription fails.\n- Subscriptions don't persist across sessions. Closing a browser tab removes all its subscriptions.\n<!-- TODO: Document channel/subscription limits per site/app. -->\n\n<!-- ## Use cases\n\n- [Send notifications to connected clients](ADDLINK).\n- [Broadcast data updates in real time](ADDLINK).\n- [Push state changes to a live dashboard](ADDLINK). -->\n\n## See also\n\n- [Publisher API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/publisher/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction)\n\n@sdk_package_setup\n"
      },
      {
        "type": "GUIDE",
        "title": "Setup",
        "src": "# Setup\n\n@package_metadata:@wix/realtime\n\nTo use the Realtime API, install the `@wix/realtime` package.\n\n#### Install the package\n\nFollow the installation instructions for your development environment.\n\n| Development environment   | Installation method                                                                                                                                                         |\n| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor).                               |\n| Wix sites (local IDE)     | Run `wix install @wix/realtime` using the [Wix CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli). |\n| CLI and self-managed apps | Run `npm install @wix/realtime` or `yarn add @wix/realtime`. |\n| Headless sites and apps | Run `npm install @wix/realtime` or `yarn add @wix/realtime`.|\n\n#### Import the package\n\nTo import the package in your code:\n\n```js\nimport { subscriber } from '@wix/realtime';\n```\n"
      }
    ],
    "/site": [
      {
        "type": "GUIDE",
        "title": "Introduction",
        "src": "---\narticleType: intro\n---\n\n# About the Site API\n\nThe Site API lets you control subscriber permissions for the [Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction). It determines which [subscribers](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction) can receive messages on specific [channels and resources](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#channels-and-channel-resources).\n\nWith the Site API, you can:\n\n- Use the [permissions router](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction) to organize permission logic per channel or resource.\n- Control subscriber access using the [`realtime_check_permission` hook](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/realtime-check-permission).\n\n<blockquote class=\"important\">\n\n__Important:__\nYou can only use the Site API when [developing websites](https://dev.wix.com/docs/develop-websites-sdk/get-started/overview/about-developing-websites). When [building apps](https://dev.wix.com/docs/build-apps/get-started/overview/about-wix-apps), subscribers receive the default `{ read: true }` permissions.\n\nTo provide custom permission checks for channels your app manages, implement the [Realtime Permissions service plugin](https://dev.wix.com/docs/sdk/core-modules/realtime/extensions/realtime-permissions-provider/introduction). \n\nLearn more about [cross-app subscriptions](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction#cross-app-subscriptions).\n\n</blockquote>\n\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n- In Wix Studio, you must create a `realtime-permissions.js` file in a site's backend, even if `realtime_check_permission` isn't defined. Without the file, subscriptions fail.\n- When the `realtime_check_permission` hook isn't defined, all subscribers receive the default permissions of `{\"read\": true}`.\n- When previewing a site, `read` permissions are always `true`.\n\n## Use cases\n\nRestrict a channel so only the Wix user can receive messages. Use the [permissions router](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction) to add a handler that checks `subscriber.type`:\n\n```js\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\npermissionsRouter.add({ name: \"owner-only\" }, (channel, subscriber) => {\n  return { read: subscriber.type === \"USER\" };\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return permissionsRouter.check(channel, subscriber);\n}\n```\n\n## See also\n\n- [Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction)\n- [Permissions Router API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/introduction)\n- [Subscriber API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction)\n- [Publisher API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/publisher/introduction)\n\n@sdk_package_setup\n"
      },
      {
        "type": "GUIDE",
        "title": "Setup",
        "src": "# Setup\n\n@package_metadata:@wix/realtime\n\nTo use the Realtime API, install the `@wix/realtime` package.\n\n#### Install the package\n\nFollow the installation instructions for your development environment.\n\n| Development environment | Installation method |\n|--|--|\n| Wix sites (editor or IDE) | Use the [package manager](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-in-the-editor). |\n| Wix sites (local IDE) | Run ` wix install @wix/realtime` using the [Wix CLI](https://dev.wix.com/docs/develop-websites/articles/coding-with-velo/packages/work-with-npm-packages-with-the-wix-cli).|\n\n#### Import the package\n\nTo import the package in your code:\n\n```js\nimport { site } from `@wix/realtime`;\n```"
      }
    ],
    "/site/publish": [
      {
        "type": "EXAMPLE",
        "title": "Publish to a channel",
        "src": "import { site } from `@wix/realtime`;\n\n// ...\n\nconst channel = {\n  \"name\": \"recipes\",\n  \"resourceId\": \"9373b6bd-051e-4716-9591-91349cac8bd1\"\n};\n\nsite.publish(channel, \"Stay tuned for new recipes!\")\n  .then(() => {\n    // published\n  });"
      },
      {
        "type": "EXAMPLE",
        "title": "Publish to a resource on a channel",
        "src": "import { site } from `@wix/realtime`;\n\n// ...\n\nconst channel = {\n  \"name\": \"Work updates\"\n};\n\nconst message = {\n  \"subject\": \"Design review\",\n  \"description\": \"Meeting to review the latest widget design\"\n};\n\nconst user1 = // get ID of first user to publish to\nconst user2 = // get ID of second user to publish to\n\nconst options = {\n  \"users\" : [user1, user2],\n  \"includePublisher\": true\n};\n\nsite.publish(channel, message, options)\n  .then( () => {\n    // published\n  } );"
      },
      {
        "type": "EXAMPLE",
        "title": "Publish to specific users on a channel and include publisher information",
        "src": "/* Backend */\nimport { site } from `@wix/realtime`;\n\nexport function publishMessage(channel, message) {\n   return site.publish(channel, message);\n}\n\n/* Frontend */\nimport { realtime } from \"@wix/site-realtime\";\nimport { publishMessage } from 'backend/realtime';\n\nconst channelA = { name: 'a' };\nconst channelB = { name: 'b' };\nconst channelB1 = { name: 'b', resourceId: '1' };\nconst channelB2 = { name: 'b', resourceId: '2' };\n\n$w.onReady(function () {\n  subscribeToChannels();\n  setupPublishButtons();\n});\n\nfunction subscribeToChannels() {\n  realtime.subscribe(channelA, messageHandler);\n  realtime.subscribe(channelB, messageHandler);\n  realtime.subscribe(channelB1, messageHandler);\n  realtime.subscribe(channelB2, messageHandler);\n}\n\nfunction setupPublishButtons() {\n  $w('#publishButtonA').onClick(event => {\n    publish(event.target, channelA);\n  });\n\n  $w('#publishButtonB').onClick(event => {\n    publish(event.target, channelB);\n  });\n\n  $w('#publishButtonB1').onClick(event => {\n    publish(event.target, channelB1);\n  });\n\n  $w('#publishButtonB2').onClick(event => {\n    publish(event.target, channelB2);\n  });\n}\n\nasync function publish(button, channel) {\n  if ($w('#message').value) {\n    button.disable();\n    $w('#message').disable();\n\n    await publishMessage(channel, $w('#message').value);\n\n    $w('#message').value = undefined;\n    $w('#message').enable();\n    button.enable();\n  }\n}\n\nfunction messageHandler(message, channel) {\n  let textBoxId;\n\n  if (channel.name === 'a') {\n    textBoxId = '#receivedMessagesA';\n  } else { // Channel B - check resource ID\n    if (channel.resourceId === '1') {\n      textBoxId = '#receivedMessagesB1';\n    } else if (channel.resourceId === '2') {\n      textBoxId = '#receivedMessagesB2';\n    } else {\n      textBoxId = '#receivedMessagesB';\n    }\n  }\n\n  $w(textBoxId).value += (message.payload + '\\n');\n}"
      }
    ],
    "/site/realtime_check_permission": [
      {
        "type": "EXAMPLE",
        "title": "Grant permissions for a channel based on subscriber type",
        "src": "// In realtime-permissions.js\n\nexport function realtime_check_permission(channel, subscriber) {\n  // set default permissions\n  let permissions =  {\"read\": true};\n  \n  if(channel.name === \"MembersOnly\") {\n    if(subscriber.type === \"Member\"){\n      permissions.read = true; \n    }\n    else {\n      permissions.read = false;\n    }\n  }\n  \n  return permissions;\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions for a channel based on subscriber type using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default( (channel, subscriber) => {\n  return {\"read\": true};\n} );\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add(membersOnlyChannel, (channel, subscriber) => {\n  if(subscriber.type === \"Member\") {\n    return {\"read\": true};\n  }\n  else {\n    return {\"read\": false};\n  }\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel,subscriber);\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions based on user data",
        "src": "// In realtime-permissions.js\n\nimport { members } from `wix-members-backend`;\n\nexport async function realtime_check_permission(channel, subscriber) {\n  // set default permissions\n  let permissions =  { \"read\": true };\n\n  if(channel.name === \"BobsOnly\") {\n    let member = await members.getMember(subscriber.id, { fieldsets: ['FULL'] });\n    if(member.contactDetails.firstName === \"Bob\") {\n      permissions.read = true;\n    }\n    else {\n      permissions.read = false;\n    }\n  }\n  \n  return permissions;\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions based on user data using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { members } from `@wix/members`;\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default((channel, subscriber) => {\n  return {\"read\": true};\n});\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add( membersOnlyChannel, async (channel, subscriber) => {\n  let member = await members.getMember(subscriber.id, { fieldsets: ['FULL'] });\n  \n  if(channel.resourceId === \"BobsOnly\") {\n    if(member.contactDetails.firstName === \"Bob\") {\n      return { \"read\": true };\n    }\n    else {\n      return { \"read\": false };\n    }\n  }\n  else {\n    return { \"read\": true };\n  }\n} );\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel, subscriber);\n}"
      }
    ],
    "/site/permissionsRouter": [
      {
        "type": "EXAMPLE",
        "title": "Grant permissions for a channel based on subscriber type using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default( (channel, subscriber) => {\n  return {\"read\": true};\n} );\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add(membersOnlyChannel, (channel, subscriber) => {\n  if(subscriber.type === \"Member\") {\n    return {\"read\": true};\n  }\n  else {\n    return {\"read\": false};\n  }\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel,subscriber);\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions based on user data using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { members } from `@wix/members`;\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default((channel, subscriber) => {\n  return {\"read\": true};\n});\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add( membersOnlyChannel, async (channel, subscriber) => {\n  let member = await members.getMember(subscriber.id, { fieldsets: ['FULL'] });\n  \n  if(channel.resourceId === \"BobsOnly\") {\n    if(member.contactDetails.firstName === \"Bob\") {\n      return { \"read\": true };\n    }\n    else {\n      return { \"read\": false };\n    }\n  }\n  else {\n    return { \"read\": true };\n  }\n} );\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel, subscriber);\n}"
      }
    ],
    "/site/PermissionsRouter": [
      {
        "type": "GUIDE",
        "title": "Introduction",
        "src": "---\narticleType: intro\n---\n\n# About the Permissions Router API\n\nThe Permissions Router API is a utility for organizing channel permission logic. The router lets you set up a default permissions handler as well as handlers specific to channels or resources.\n\n> **Note:** Alternatively, you can include permissions logic directly in the [`realtime_check_permission()` hook](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/realtime-check-permission).\n\nLearn more about the [Site API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/introduction) and the [Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction).\n\nWith the Permissions Router API, you can:\n\n- [Add a handler](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/add) for a specific channel or resource.\n- [Set a default handler](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/default) for channels that don't have explicit handlers.\n- [Check](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/check) subscriber permissions.\n\n## Setting up permissions\n\nTo set up permissions using the router:\n\n1. Create a `realtime-permissions.js` file in a site's backend.\n2. Import the `permissionsRouter`:\n\n   ```js\n   import { site } from \"@wix/realtime\";\n   const { permissionsRouter } = site;\n   ```\n\n3. Define permission handlers. Use [`add()`](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/add) for specific channels or resources, and [`default()`](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/default) for a default fallback handler:\n\n   ```js\n   // Set a default handler that grants read access to all subscribers\n   permissionsRouter.default((channel, subscriber) => {\n     return { read: true };\n   });\n\n   // Restrict a specific channel to logged-in members\n   permissionsRouter.add({ name: \"members-only\" }, (channel, subscriber) => {\n     return { read: subscriber.type === \"MEMBER\" };\n   });\n   ```\n\n4. Export the `realtime_check_permission` hook and call `check()` in the body of the hook to delegate to the router:\n\n   ```js\n   export function realtime_check_permission(channel, subscriber) {\n     return permissionsRouter.check(channel, subscriber);\n   }\n   ```\n\n## Permission resolution\n\nPermissions can be set at the channel level or the resource level. They determine whether subscribers can receive messages published to that channel or resource.\n\nPermissions follow a cascading pattern:\n\n- When a resource [doesn't have a permissions handler](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/add), the handler for its parent channel runs.\n- When the parent channel doesn't have a permissions handler, the [default permissions handler](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/permissions-router/default) runs.\n- When no default handler is set, all subscribers receive the default permissions of `{ \"read\": true }`.\n\n> **Note:** Permissions are checked once per subscription attempt, including [re-subscriptions after reconnection](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction#core-modules_realtime_realtime_subscriber_reconnection-and-message-sync). Changes to permissions don't affect active subscriptions until the subscriber reconnects.\n\n## Before you begin\n\nIt's important to note the following points before starting to code:\n\n- You must create a `realtime-permissions.js` file in a site's backend, even if you don't define any custom permissions. Without it, all subscriptions fail in Wix Studio.\n- When the `realtime_check_permission` hook isn't defined, all subscribers receive the default permissions of `{\"read\": true}`.\n- When previewing a site, `read` permissions are always `true`.\n\n## Use cases\n\nRestrict the `announcements` channel so only logged-in members can receive messages. All other channels remain open to everyone:\n\n```js\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\n// Only logged-in members can listen to announcements\npermissionsRouter.add({ name: \"announcements\" }, (channel, subscriber) => {\n  return { read: subscriber.type === \"MEMBER\" };\n});\n\n// All other channels are open to everyone\npermissionsRouter.default((channel, subscriber) => {\n  return { read: true };\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return permissionsRouter.check(channel, subscriber);\n}\n```\n\n## See also\n\n- [Realtime APIs](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/introduction)\n- [Site API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/site/introduction)\n- [Subscriber API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/subscriber/introduction)\n- [Publisher API](https://dev.wix.com/docs/sdk/core-modules/realtime/realtime/publisher/introduction)\n\n@sdk_package_setup\n"
      }
    ],
    "/site/PermissionsRouter/add": [
      {
        "type": "EXAMPLE",
        "title": "Set a permissions handler for a specific channel",
        "src": "// In realtime-permissions.js\n\nimport { site } from \"@wix/realtime\";\nconst { permissionsRouter } = site;\n\n// Only the Wix user can listen to announcements\npermissionsRouter.add({ name: \"announcements\" }, (channel, subscriber) => {\n  return { read: subscriber.type === \"USER\" };\n});\n\n// Export the hook and delegate to the router\nexport function realtime_check_permission(channel, subscriber) {\n  return permissionsRouter.check(channel, subscriber);\n}\n"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions for a channel based on subscriber type using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default( (channel, subscriber) => {\n  return {\"read\": true};\n} );\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add(membersOnlyChannel, (channel, subscriber) => {\n  if(subscriber.type === \"Member\") {\n    return {\"read\": true};\n  }\n  else {\n    return {\"read\": false};\n  }\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel,subscriber);\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions based on user data using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { members } from `@wix/members`;\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default((channel, subscriber) => {\n  return {\"read\": true};\n});\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add( membersOnlyChannel, async (channel, subscriber) => {\n  let member = await members.getMember(subscriber.id, { fieldsets: ['FULL'] });\n  \n  if(channel.resourceId === \"BobsOnly\") {\n    if(member.contactDetails.firstName === \"Bob\") {\n      return { \"read\": true };\n    }\n    else {\n      return { \"read\": false };\n    }\n  }\n  else {\n    return { \"read\": true };\n  }\n} );\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel, subscriber);\n}"
      }
    ],
    "/site/PermissionsRouter/check": [
      {
        "type": "EXAMPLE",
        "title": "Check permission for a subscriber to a channel",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\n// ...\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel,subscriber);\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions for a channel based on subscriber type using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default( (channel, subscriber) => {\n  return {\"read\": true};\n} );\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add(membersOnlyChannel, (channel, subscriber) => {\n  if(subscriber.type === \"Member\") {\n    return {\"read\": true};\n  }\n  else {\n    return {\"read\": false};\n  }\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel,subscriber);\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions based on user data using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { members } from `@wix/members`;\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default((channel, subscriber) => {\n  return {\"read\": true};\n});\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add( membersOnlyChannel, async (channel, subscriber) => {\n  let member = await members.getMember(subscriber.id, { fieldsets: ['FULL'] });\n  \n  if(channel.resourceId === \"BobsOnly\") {\n    if(member.contactDetails.firstName === \"Bob\") {\n      return { \"read\": true };\n    }\n    else {\n      return { \"read\": false };\n    }\n  }\n  else {\n    return { \"read\": true };\n  }\n} );\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel, subscriber);\n}"
      }
    ],
    "/site/PermissionsRouter/default": [
      {
        "type": "EXAMPLE",
        "title": "Set a default permissions handler",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\n// ...\n\nsite.permissionsRouter.default( (channel, subscriber) => {\n  // return default permissions\n  return {\"read\": true};\n} );"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions for a channel based on subscriber type using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default( (channel, subscriber) => {\n  return {\"read\": true};\n} );\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add(membersOnlyChannel, (channel, subscriber) => {\n  if(subscriber.type === \"Member\") {\n    return {\"read\": true};\n  }\n  else {\n    return {\"read\": false};\n  }\n});\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel,subscriber);\n}"
      },
      {
        "type": "EXAMPLE",
        "title": "Grant permissions based on user data using the permissions router",
        "src": "// In realtime-permissions.js\n\nimport { members } from `@wix/members`;\nimport { site } from `@wix/realtime`;\n\nsite.permissionsRouter.default((channel, subscriber) => {\n  return {\"read\": true};\n});\n\nconst membersOnlyChannel = {\"name\": \"MembersOnly\"};\n\nsite.permissionsRouter.add( membersOnlyChannel, async (channel, subscriber) => {\n  let member = await members.getMember(subscriber.id, { fieldsets: ['FULL'] });\n  \n  if(channel.resourceId === \"BobsOnly\") {\n    if(member.contactDetails.firstName === \"Bob\") {\n      return { \"read\": true };\n    }\n    else {\n      return { \"read\": false };\n    }\n  }\n  else {\n    return { \"read\": true };\n  }\n} );\n\nexport function realtime_check_permission(channel, subscriber) {\n  return site.permissionsRouter.check(channel, subscriber);\n}"
      }
    ]
  },
  "standaloneTypes": {},
  "metadata": {}
}
