FIP: Add Message Type Filtering to Hub API Endpoints #253
Replies: 1 comment 2 replies
-
|
How will I keep hearing from people who would like a lighter node, one that syncs selectively (specific FIDs for example), or on-demand. I would like hubs to do the bare minimum in order to a) keep implementation complexity down and b) keep hw requirements down. If it is trivial to implement, that's a good idea. If it adds any complexity, clients who need it, should implement it on their side. And if it's a common need, there could be a proxy that implements these type of filtering and data-processing. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Abstract
Add optional
message_typequery parameter to Hub API endpoints (castsByFid,reactionsByFid, etc.) to allow filtering between ADD and REMOVE message types. This reduces bandwidth, improves performance, and enables more efficient pagination for applications that only need to process one message type.Problem Statement
Currently, Hub API endpoints like
castsByFidandreactionsByFidreturn all message types (bothMESSAGE_TYPE_*_ADDandMESSAGE_TYPE_*_REMOVE) without the ability to filter. According to documentation,castsByFidshould "return CastAdds for an Fid in reverse chron order," but in practice, it returns both ADD and REMOVE messages.This creates significant inefficiencies:
Unnecessary data transfer: Applications that only need ADD messages (e.g., displaying a user's casts) must download and filter out all REMOVE tombstones client-side.
Pagination overhead: For users who have deleted most of their content, applications must paginate through potentially thousands of REMOVE messages to find remaining ADD messages. For example, a user with 2,300 deletion tombstones requires 23+ API requests (at 100 items per page) before reaching any actual content.
Processing waste: Every application must implement identical client-side filtering logic, duplicating work that could be done once at the Hub level.
Proposed Solution
Add an optional
message_typequery parameter to message retrieval endpoints:Parameter Specification
message_typeMESSAGE_TYPE_*_ADD,MESSAGE_TYPE_*_REMOVEnull(no filter)When unspecified, endpoints return all messages (current behavior). When specified, only messages of that type are returned.
Use Cases
1. Content Display
Applications displaying a user's posts need only ADD messages. Filtering removes unnecessary REMOVE tombstones from the response.
2. Deletion Tools
Applications helping users delete old content need only ADD messages to identify what can be deleted. Currently, they must paginate through all REMOVE messages (previously deleted content) to find remaining ADD messages.
3. Analytics & Indexing
Services indexing Farcaster content can fetch only ADD messages initially, then separately process REMOVE messages for state reconciliation.
4. Bandwidth-Constrained Clients
Mobile and embedded clients benefit from smaller response sizes when they only need one message type.
Rationale
Why not filter client-side?
Why not use a different endpoint?
/castAddsByFid,/castRemovesByFid) increases API surface areaBackward compatibility:
message_typeis omitted, behavior is unchanged (all messages returned)Example: Current vs Proposed
Current Behavior (User with deleted content)
Proposed Behavior
References
Beta Was this translation helpful? Give feedback.
All reactions