File
Blob: types/defines/pubsub.d.ts
| 1 | // PubSubMessage represents an incoming PubSub message. |
| 2 | // The message includes metadata about the broker, the client, and the payload |
| 3 | // itself. |
| 4 | // https://developers.cloudflare.com/pub-sub/ |
| 5 | interface PubSubMessage { |
| 6 | // Message ID |
| 7 | readonly mid: number; |
| 8 | // MQTT broker FQDN in the form mqtts://BROKER.NAMESPACE.cloudflarepubsub.com:PORT |
| 9 | readonly broker: string; |
| 10 | // The MQTT topic the message was sent on. |
| 11 | readonly topic: string; |
| 12 | // The client ID of the client that published this message. |
| 13 | readonly clientId: string; |
| 14 | // The unique identifier (JWT ID) used by the client to authenticate, if token |
| 15 | // auth was used. |
| 16 | readonly jti?: string; |
| 17 | // A Unix timestamp (seconds from Jan 1, 1970), set when the Pub/Sub Broker |
| 18 | // received the message from the client. |
| 19 | readonly receivedAt: number; |
| 20 | // An (optional) string with the MIME type of the payload, if set by the |
| 21 | // client. |
| 22 | readonly contentType: string; |
| 23 | // Set to 1 when the payload is a UTF-8 string |
| 24 | // https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901063 |
| 25 | readonly payloadFormatIndicator: number; |
| 26 | // Pub/Sub (MQTT) payloads can be UTF-8 strings, or byte arrays. |
| 27 | // You can use payloadFormatIndicator to inspect this before decoding. |
| 28 | payload: string | Uint8Array; |
| 29 | } |
| 30 | |
| 31 | // JsonWebKey extended by kid parameter |
| 32 | interface JsonWebKeyWithKid extends JsonWebKey { |
| 33 | // Key Identifier of the JWK |
| 34 | readonly kid: string; |
| 35 | } |