When to use this
Limelight automatically captures requests made throughfetch and XMLHttpRequest. However, some apps route network traffic through other channels:
- Native network modules - Custom native modules that handle HTTP requests at the iOS/Android layer
- Custom Apollo Links - Apollo Client configurations that bypass fetch entirely
- WebSocket-based transports - GraphQL subscriptions or custom protocols
- Third-party SDKs - Libraries with their own networking stack
Basic usage
GraphQL requests
For GraphQL operations, include thegraphql config to get full query analysis in Limelight:
Apollo Client integration
If you’re using Apollo Client with a custom link that bypasses fetch, create a Limelight link:Handling errors
UsefailRequest when a request fails:
API reference
Limelight.startRequest(config)
Starts tracking a request. Call this before making the actual network request.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The request URL |
method | string | No | HTTP method (defaults to POST) |
headers | Record<string, string> | No | Request headers |
body | any | No | Request body |
name | string | No | Custom display name |
graphql | object | No | GraphQL operation details |
graphql.operationName | string | No | Operation name |
graphql.operationType | "query" | "mutation" | "subscription" | No | Operation type |
graphql.variables | object | No | Operation variables |
graphql.query | string | No | Query string |
string - A request ID to use with endRequest or failRequest.
Limelight.endRequest(requestId, response)
Completes a tracked request with a successful response.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
requestId | string | Yes | The ID returned from startRequest |
response.status | number | Yes | HTTP status code |
response.statusText | string | No | HTTP status text |
response.headers | Record<string, string> | No | Response headers |
response.body | any | No | Response body |
Limelight.failRequest(requestId, error)
Completes a tracked request with an error.
Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
requestId | string | Yes | The ID returned from startRequest |
error | Error | string | Yes | The error that occurred |