{part.text}
); } if (part.type.startsWith("tool-")) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const p = part as any; const toolName = part.type.slice(5); const isDone = p.state === "output-available"; return ({toolName}{" "}
{isDone ? "✓" : "running…"}
{isDone && p.output && (
{String(p.output.output)}
)}
It works!
", }, }); ``` In the `body` field, specify any parameters supported by [the Resend Send Email API](https://resend.com/docs/api-reference/emails/send-email), such as `from`, `to`, `subject`, and `html`. ## Sending Batch Emails To send multiple emails at once, use Resend’s [Batch Email API](https://resend.com/docs/api-reference/emails/send-batch-emails). Set the `batch` option to `true` to enable batch sending. Each email configuration is defined as an object within the `body` array. ```typescript await client.publishJSON({ api: { name: "email", provider: resend({ token: "It works!
", }, ], }); ``` Each entry in the `body` array represents an individual email, allowing customization of `from`, `to`, `subject`, `html`, and any other Resend-supported fields. # Development Server License Agreement Source: https://upstash.com/docs/qstash/misc/license ## 1. Purpose and Scope This software is a development server implementation of QStash API ("Development Server") provided for testing and development purposes only. It is not intended for production use, commercial deployment, or as a replacement for the official QStash service. ## 2. Usage Restrictions By using this Development Server, you agree to the following restrictions: a) The Development Server may only be used for: * Local development and testing * Continuous Integration (CI) testing * Educational purposes * API integration development b) The Development Server may NOT be used for: * Production environments * Commercial service offerings * Public-facing applications * Operating as a Software-as-a-Service (SaaS) * Reselling or redistributing as a service ## 3. Restrictions on Modification and Reverse Engineering You may not: * Decompile, reverse engineer, disassemble, or attempt to derive the source code of the Development Server * Modify, adapt, translate, or create derivative works based upon the Development Server * Remove, obscure, or alter any proprietary rights notices within the Development Server * Attempt to bypass or circumvent any technical limitations or security measures in the Development Server ## 4. Technical Limitations Users acknowledge that the Development Server: * Operates entirely in-memory without persistence * Provides limited functionality compared to the official service * Offers no data backup or recovery mechanisms * Has no security guarantees * May have performance limitations * Does not implement all features of the official service ## 5. Warranty Disclaimer THE DEVELOPMENT SERVER IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. THE AUTHORS OR COPYRIGHT HOLDERS SHALL NOT BE LIABLE FOR ANY CLAIMS, DAMAGES, OR OTHER LIABILITY ARISING FROM THE USE OF THE SOFTWARE IN VIOLATION OF THIS LICENSE. ## 6. Termination Your rights under this license will terminate automatically if you fail to comply with any of its terms. Upon termination, you must cease all use of the Development Server. ## 7. Acknowledgment By using the Development Server, you acknowledge that you have read this license, understand it, and agree to be bound by its terms. # API Examples Source: https://upstash.com/docs/qstash/overall/apiexamples ### Use QStash via: * cURL * [Typescript SDK](https://github.com/upstash/sdk-qstash-ts) * [Python SDK](https://github.com/upstash/qstash-python) Below are some examples to get you started. You can also check the [how to](/docs/qstash/howto/publishing) section for more technical details. ### Publish a message to an endpoint Simple example to [publish](/docs/qstash/howto/publishing) a message to an endpoint.Active channels: {channels.join(", ")}
Listening for events...
} ``` ## Provider OptionsStatus: {status}
Notifications {user ? "enabled" : "disabled"}
} ``` ## Multiple Events Subscribe to multiple events at once: ```tsx page.tsx "use client" import { useRealtime } from "@/lib/realtime-client" export default function Page() { useRealtime({ events: ["chat.message", "chat.reaction", "user.joined"], onData({ event, data, channel }) { // 👇 data is automatically typed based on the event if (event === "chat.message") console.log("New message:", data) if (event === "chat.reaction") console.log("New reaction:", data) if (event === "user.joined") console.log("User joined:", data) }, }) returnListening to multiple events
} ``` ## Multiple Channels Subscribe to multiple channels at once: ```tsx page.tsx "use client" import { useRealtime } from "@/lib/realtime-client" export default function Page() { useRealtime({ channels: ["global", "announcements", "user-123"], events: ["notification.alert"], onData({ event, data, channel }) { console.log(`Message from ${channel}:`, data) }, }) returnListening to multiple channels
} ``` ### Dynamic Channel Management Add and remove channels dynamically: ```tsx page.tsx "use client" import { useState } from "react" import { useRealtime } from "@/lib/realtime-client" export default function Page() { const [channels, setChannels] = useStateActive channels: {channels.join(", ")}
Listening for notifications...
} ```{msg.sender}: {msg.text}
))}Active Users: {metrics?.users}
Revenue: ${metrics?.revenue}
Status: {status}
} ``` ## Message Delivery Guarantee Upstash Realtime is powered by Redis Streams, so no message is ever delivered twice or gets lost. Every message is guaranteed to be delivered exactly once. 1. Client establishes connection and subscribes to stream 2. Client initiates reconnection before function timeout (default every 5 mins) 3. Redis auto-replays all messages sent during reconnect # Pricing Source: https://upstash.com/docs/realtime/overall/pricing **Upstash Realtime is designed to be extremely cost-efficient.** With minimal Redis commands per operation and smart connection management, you can build real-time features at scale without worrying about costs. Upstash Realtime is built on Redis Streams and Pub/Sub. Every operation translates to one or more Redis commands, detailed below. ## Command Overview ### Client-Side Operations When using [`useRealtime`](/docs/realtime/features/client-side#basic-usage) in your React components: | Operation | Commands | Count | | --------- | -------- | ----- | | Initial connection | SUBSCRIBE, XRANGE | 2 | | Reconnection every 300 seconds | UNSUBSCRIBE, XRANGE, SUBSCRIBE | 3 | | Ping to keep connection alive every 60 seconds | PUBLISH | 1 | ### Server-Side Operations When using the [server-side API](/docs/realtime/features/server-side): | Operation | Commands | Count | | --------- | -------- | ----- | | [Emit event](/docs/realtime/features/server-side#emit-events) | PUBLISH, XADD | 2 | | Emit with [`expireAfterSecs`](/docs/realtime/features/history#param-expire-after-secs) | PUBLISH, XADD, EXPIRE | 3 | | [Read history](/docs/realtime/features/history#server-side-history) | XRANGE | 1 | ## Next StepsListening for events...
} ``` That's it! Your app is now listening for realtime events with full type safety. 🎉 ### 9. Realtime Dashboard For debugging or monitoring purposes, you can use Realtime Dashboard in console.