Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
PreviousRate-Limit Simulator
NextSession Quotas & Activity
Chaos & Fault Injection

Flaky Network & Probabilistic Jitter

Subject your frontend to real-world network instability. Randomly fail requests with configurable failure probabilities (e.g. 25%, 50%, or 75% drop rates) and stochastic jitter delays to verify TanStack Query retries, SWR deduplication, and circuit breakers.

Interactive Probabilistic Chaos Runner

Configure failure likelihood and targeted error codes, then click "Send" repeatedly to observe intermittent failures:

10% (Subtle)50% (Flaky)90% (Outage)

When chaos triggers, the server randomly picks from these status codes.

Flaky Request (50% Chance of Failure)

Click Send repeatedly. When chaos fires, the server injects 250-1500ms of latency jitter and throws an error.

GET
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Chaos Modifiers Reference

Modifier / HeaderTypeValid ValuesBehavior
?_chaos=valueQuery Param0.0 to 1.0 (or 0-100)Probability of random rejection. E.g. 0.3 = 30% failure rate.
X-Simulate-ChaosHTTP Header0.5Header equivalent for CI/CD test runners or automated regression suites.
?_chaos_errorsQuery Param500,502,503Comma-separated list of target HTTP error codes to randomly select from upon failure.
Network JitterBuilt-in250ms - 1500msWhenever chaos triggers, stochastic latency is automatically added to simulate packet lag.

Resilient Retries with TanStack React Query

Configure automatic exponential retries in your data-fetching hooks to make your UI resilient against transient network drops:

useResilientPosts.ts
1
// Configuring resilient retries in TanStack Query (React Query)
2
import { useQuery } from '@tanstack/react-query';
3
4
export function useResilientPosts() {
5
return useQuery({
6
queryKey: ['posts'],
7
queryFn: async () => {
8
// Connect to endpoint with 50% probabilistic chaos injected
9
const res = await fetch('https://playground.nileslabs.com/api/v1/posts?_chaos=0.5', {
10
credentials: 'include',
11
});
12
13
if (!res.ok) {
14
throw new Error(HTTP failure ${res.status}: ${res.statusText});
15
}
16
17
return res.json();
18
},
19
// Retry up to 3 times for transient 5xx / 429 errors
20
retry: (failureCount, error: any) => {
21
if (failureCount >= 3) return false;
22
// Do not retry 400 Bad Request or 404 Not Found
23
return !error.message.includes('400') && !error.message.includes('404');
24
},
25
// Exponential backoff: 500ms, 1000ms, 2000ms
26
retryDelay: (attemptIndex) => Math.min(1000 * 2 ** attemptIndex, 10000),
27
});
28
}

Want to inspect session telemetry?

Monitor active memory quotas, storage consumption, and visitor session identities.

View Session Quotas