Skip to main content
While the Pump.fun API doesn’t currently expose dedicated WebSocket endpoints in the documented specification, you can implement real-time functionality using efficient polling strategies.

Polling strategies

Simple polling

The most straightforward approach is to poll endpoints at regular intervals:
Python

Smart polling with ETag caching

Use ETag headers to reduce bandwidth and avoid processing unchanged data:
Python
ETag caching can significantly reduce bandwidth usage and API load. The server returns a 304 Not Modified response when content hasn’t changed.

Adaptive polling

Adjust polling frequency based on activity level:
Python

Multi-endpoint monitoring

Monitor multiple endpoints simultaneously using threading:
Python
When monitoring multiple endpoints, be mindful of rate limits. Distribute your polling intervals to stay within API limits.

Event-driven updates

Implement an event system for handling real-time updates:
Python

Best practices

1

Choose appropriate intervals

Start with 5-10 second intervals for active monitoring, 30-60 seconds for less critical updates.
2

Implement exponential backoff

When encountering errors or rate limits, increase polling intervals exponentially.
3

Use ETag caching

Always include If-None-Match headers when available to reduce bandwidth.
4

Monitor rate limits

Track x-ratelimit-remaining headers and adjust polling behavior accordingly.
5

Deduplicate data

Maintain a set of seen IDs to avoid processing duplicate data.
6

Handle errors gracefully

Implement proper error handling and continue polling even after failures.
If Pump.fun introduces native WebSocket support in the future, migrate to that for more efficient real-time updates with lower latency and reduced server load.