Real-Time Clipboard Sync: Where the Seconds Actually Go
Every clipboard tool calls itself real time. A walk through the actual latency budget of a browser-based sync, with the intervals we use and the four things that reliably ruin them.
- 6 min read
- Published
- By MyClipCloud Team
A browser clipboard is not instant, and the delay is mostly waiting rather than network. In MyClipCloud a copy is noticed immediately in the page (every 1.5 seconds with the Chrome extension), uploaded over HTTPS, given an ordered sequence number, and then has to reach the other device — a WebSocket poke when one is available, otherwise a poll every 2.5 seconds while the tab is visible and every 15 seconds while it is hidden. Writing the item onto the receiving clipboard needs that tab to be in front.
"Real-time clipboard" is a phrase every tool in this category uses, including ours in places where it has crept in. It deserves a number, so here is the actual budget, interval by interval, for a clipboard that lives in a browser tab.
The path a copy takes
Five hops. Only one of them is the network.
1. notice the copy
in the page: immediate (copy event)
extension: up to 1500 ms (poll)
2. upload
POST over HTTPS + idempotency key
3. order it
one sequence number per account
4. tell the other device
a WebSocket poke, or a poll:
2500 ms tab visible
15000 ms tab hidden
30000 ms extension, 60 s idle
5. put it on the clipboard
the receiving tab must be in front
Steps 2 and 3 are the fast ones — a round trip and a database write, tens of milliseconds on a decent connection. Steps 1, 4 and 5 are where entire seconds live, and they are all about attention rather than bandwidth: is a tab open, is it visible, is it in front, is someone touching the device.
Best case, two desktop tabs both in front: well under a second. Realistic case, you copy on a laptop and pick up your phone: you unlock the phone, switch to the tab, and it is already there, because the waiting happened while you were moving. Worst case, a backgrounded tab on a sleeping laptop: as long as it takes you to wake it up.
Why we poll at all
The obvious objection: why not push everything over a WebSocket and be done?
We do have one, and it is optional — realtimeEnabled is a server switch, and plenty of shared hosting cannot run a long-lived WebSocket process at all. So the polling path is not a fallback bolted on afterwards. It is the baseline, and the WebSocket is an accelerator.
That decision shaped the protocol in a way we are glad about. The WebSocket only ever carries a poke — a one-bit "something changed". It never carries clipboard content. The client answers every poke by reading the ordered event list from the API, exactly as the poll does:
GET /sync/events?after=<cursor>
Which means a lost poke, a duplicated poke, or a poke arriving out of order cannot corrupt anything. The worst a broken WebSocket does is make things slower, and then the 2.5-second poll quietly covers it. A design where the socket carried the payload would have given us two code paths to keep consistent and a new class of bug. The token is sent in the socket's first message rather than in the URL, for the dull reason that URLs end up in logs.
Four things that reliably break "instant"
Background tabs are throttled on purpose
A hidden tab does not get to run on its own schedule. Browsers have tightened timer behaviour in background pages for years — Chrome documented intensive throttling of timers in hidden pages back in version 88 (Chrome: timer throttling) — and the Page Visibility API exists precisely so pages can notice and behave (MDN: Page Visibility API).
So we stop pretending. A hidden tab polls every 15 seconds instead of 2.5, and catches up the moment it becomes visible. A tool that claims a hidden tab stays instantly in sync is describing something the browser does not permit.
Phones pause pages, and then lie about focus
Mobile is the hard case. Chrome on Android pauses a page that is not on screen, so nothing arrives until you switch back. Fine — expected.
The part that cost us real debugging time is what happens in the half-second after you switch back. The page becomes visible slightly before it has focus, and in that window reading the clipboard either fails outright or quietly hands back the previous contents. Read once on becoming visible and you get yesterday's text.
So the page does not read once. It retries at 300 ms, 700 ms, 1200 ms, 2000 ms and 3000 ms after coming back, keeps watching for about 4.5 seconds even if nothing looks new, and checks again if you touch the page within 30 seconds. Those five numbers are in the source because each one was needed; a single retry was not enough on slower phones.
There is also a 4-second ceiling on any clipboard call. Chrome will happily leave one pending forever if a permission prompt is unanswered or the window is not in front, and a sync engine that waits forever is a sync engine that has stopped.
A sleeping device is not a slow device
Close the lid and nothing happens, which is correct and not worth engineering around. What matters is the state on the way back.
Every device remembers the last sequence number it applied. On waking it asks for everything after that number, applies them in order, and ignores any event id it has already seen. If it was away long enough that old events were pruned — the replay window is 7 days — it throws away its cursor and downloads a fresh snapshot instead. That branch is rare and boring, which is the point. The alternative, merging by timestamp, is how you end up with two devices showing different histories.
Several tabs of the same site
Three MyClipCloud tabs open should not mean three times the polling, and should not mean three tabs fighting over who writes to the clipboard. They coordinate over a BroadcastChannel, so state is shared within the browser rather than fetched three times. Cheap, and it removes a whole category of "it pasted twice" reports.
The extension changes two of the five numbers
The same engine with no tab requirement — the full picture is in the extension feature page — and the trade is a slower detection step for a much better receive step.
| Website tab | Chrome extension | |
|---|---|---|
| Notices a copy | Immediately, in the page | Within about 1.5 s, anywhere on the computer |
| Needs a tab open | Yes | No |
| Polls while you are away | 15 s (hidden tab) | 30 s (after 60 s idle) |
| Writes text to the clipboard | Tab must be in front | Automatically, browser running |
| Writes images to the clipboard | Tab in front | No — a notification instead |
Why the extension polls the clipboard instead of being told: there is no event for "the user copied something in another application". There is no API for it anywhere, on any platform, in a browser extension. Polling every 1.5 seconds while you are active, and pausing after 60 seconds of no keyboard or mouse, is the least-bad answer. It also means only a SHA-256 fingerprint of the last clipboard content needs storing, never the content, to avoid sending the same copy twice.
The images line is a hard browser limit, not a missing feature: Chrome only lets a focused document write an image to the clipboard, which a background extension is not (Chrome: offscreen documents, Chrome: Manifest V3).
What we will not claim
A browser clipboard is not a system clipboard, and no amount of protocol work changes that. Three limits stay:
- Nothing syncs with the browser fully closed. No background process, no tab, no sync.
- The receiving device needs a moment of your attention — a focused tab, or one click on Copy latest. Browsers require it, and we think they are right to.
- Only copies made inside the site are captured, unless you are in Chrome or Edge and have allowed clipboard access once, or you use the extension.
If you want every copy on every device with no attention at all, that needs installed software with broad clipboard access on each machine. The honest comparison is in browser clipboard sharing versus native clipboard sync.
So is it real time?
By the usual software meaning — a bounded, predictable delay — yes: a few seconds, with the bound set by browser rules rather than by our servers. By the meaning most people have in mind when they read the phrase, which is "already there", also usually yes, because the seconds are spent while you are picking up the other device.
By the strict meaning of "the instant you copy, on a device you are not looking at", no. Nothing that runs in a browser tab does that. The mechanism behind all of it is in how clipboard sync works, and if you want to watch the numbers yourself, the online clipboard shows its own status — syncing, synced, offline or reconnecting — rather than a spinner that means nothing.
Want to try it? Copy on one device and pick it up on another, in your browser. Same Wi-Fi? Nearby needs no account at all.