Skip to content
AnswerWell geo Documentation

Research · 4 min read · Answerwell

Extension GCM API Message Size Limits and References

What the 4096-byte value in Chrome extension GCM reference docs means, and how to stay within push message limits.

The Chrome extension chrome.gcm API (Google Cloud Messaging for extensions) lets a background context register for push-style messages from a backend. The cluster’s usable technical content is the numeric limit published in Google Chrome’s reference: 4096, under a Value section in both the current API reference and the Manifest V2 legacy page. This page explains what that limit is for, how the two doc URLs relate, and what to watch for when you design payloads.

chrome.gcm is the extension surface for Google Cloud Messaging (GCM)—registering an extension to receive messages identified by registrationId, sending upstream messages, and handling lifecycle events tied to cloud messaging. It is separate from web Push API / service worker push; it targets extension backgrounds (service worker or legacy background page) that declare the gcm permission and use the chrome.gcm namespace.

If you are deciding between APIs: use chrome.gcm only when you are maintaining or building an extension that already integrates with GCM-style server messaging. New work often evaluates Firebase Cloud Messaging (FCM) on the server side while still honoring Chrome’s extension payload rules where chrome.gcm applies.

GCM message size: the 4096 Value in the reference

Section titled “GCM message size: the 4096 Value in the reference”

What does 4096 mean for extension messages?

Section titled “What does 4096 mean for extension messages?”

Both official GCM reference excerpts in this topic set list the same figure:

4096

— Google Chrome, browser.gcm / GCM API

4096

— Google Chrome, chrome.gcm (Manifest V2 reference)

In Chrome’s extension GCM documentation, 4096 is the maximum message size in bytes (4 KiB) for data carried through chrome.gcm. Treat it as a hard ceiling on the payload your extension and server exchange through this API—not on HTTP headers, JSON wrapper fields you add outside the GCM data block, or unrelated storage.

Practical meaning:

Concern Guidance
Payload planning Stay under 4096 bytes for the message body the GCM layer delivers to the extension.
JSON or binary The limit applies to the encoded bytes you send, including UTF-8 expansion for non-ASCII text.
Chunking Larger content must be split (multiple messages), fetched by ID (server holds blob; message carries a key), or delivered outside GCM (e.g. fetch to your API).
Errors Oversized payloads typically fail at send or delivery rather than silently truncating—design clients and servers to validate size before send.

Manifest V2 vs current extension API reference

Section titled “Manifest V2 vs current extension API reference”

Chrome publishes GCM under two documentation paths:

Document URL Role
Current extensions API GCM API Primary reference for extensions on current manifest model
Manifest V2 legacy chrome.gcm MV2 Same 4096 Value for older MV2 extensions still on chrome.gcm

The duplicate 4096 across both pages indicates the size limit did not diverge between MV2 and the current reference in the material available here. Migration work between manifest versions should still re-check permissions, background type (event page vs service worker), and event names in the full reference—not only payload size.

Prefer small, actionable GCM data:

  • An event type and entity id (e.g. sync, user:12345).
  • A version or etag so the extension can fetch full state via HTTPS.
  • Timestamps or sequence numbers for ordering and deduplication.

Avoid embedding large HTML, full chat transcripts, or big base64 blobs in the GCM payload.

  1. Counting characters instead of bytes — Unicode and JSON escaping can push a “short” string over 4096 bytes.
  2. Including redundant fields — Duplicate metadata in every push burns the budget quickly.
  3. Assuming compression — Unless your stack explicitly supports and documents it for extension GCM, plan for uncompressed payload size.
  4. Ignoring upstream vs downstream — Whatever direction your code uses, validate size on both extension and server before calling send APIs.
  5. Using one giant message after FCM migration — Server-side FCM changes do not remove Chrome’s extension-side cap; still respect 4096 for the extension path.

Short illustration (conceptual size check)

Section titled “Short illustration (conceptual size check)”

Before calling send APIs, measure the encoded payload:

const data = { type: "refresh", id: "item_9f3a" };
const bytes = new TextEncoder().encode(JSON.stringify(data)).length;
// bytes must be <= 4096 for chrome.gcm per Chrome reference Value

Use your platform’s equivalent (TextEncoder, Buffer.byteLength, etc.) on the exact bytes GCM will carry.

  1. Open the GCM API reference and confirm the Value section still lists 4096 for your target Chrome channel.
  2. If you maintain an MV2 extension, cross-check the same Value on the MV2 chrome.gcm page.
  3. In your extension project, log or assert encoded payload size on the send path and reject payloads over 4096 bytes before they reach GCM.
  4. Trigger a test push with a payload just under the limit and one intentionally over the limit; confirm the over-limit case fails predictably in your server logs and extension UI.
  5. You can check automatically in Answerwell (our tool): https://answerwell.org/workspace

If something on this page does not match the GCM API or MV2 chrome.gcm reference, email yimasynthetic@gmail.com with the page URL and the statement you are asking about.