#515·PairDrop

[Bug] Network information changes interrupt active file transfers

Author: WWYCOOLCreated Sep 22, 2026Updated Sep 22, 2026
Labelsbug

Description

An active file transfer occasionally stops when the sending phone displays “Connected.” Diagnostic logs show that a change in the browser’s estimated network RTT triggers an unconditional WebSocket disconnect and reconnect.

The issue tends to occur during the first few transfers after connecting devices. After a successful transfer, it appears less frequently.

Environment

  • Sender: Android, Microsoft Edge
  • Receiver: macOS, Microsoft Edge
  • Network: Corporate LAN; phone connected via Wi-Fi
  • Deployment: Self-hosted Docker instance with a local STUN server
  • Version: Internal fork based on PairDrop v1.11.2

The relevant navigator.connection event handler also exists in upstream master.

Steps to reproduce

  1. Open PairDrop on both devices and connect them.
  2. Send a file from the Android phone to the computer.
  3. During an active transfer, the phone occasionally displays “Connected” and the transfer stops.

This is intermittent. We added diagnostic logging without changing the existing reconnection behavior and captured the following sequence.

Diagnostic evidence

Event Observed details
Transfer in progress Most recent progress sample was approximately 25%
Phone receives network-change Estimated rtt changes from 200 ms to 300 ms; other recorded network properties remain unchanged
Phone requests WebSocket disconnect Reason: network-change; WebSocket is still OPEN, online: true, page visibility is visible
Server removes the connection Reason: client-disconnect; only 582 ms have elapsed since the last application heartbeat
Computer receives peer departure peer-left with disconnect: true
Phone’s data channel closes Transfer is still busy, with bufferedAmount: 128000
Phone reconnects WebSocket becomes ready again and the “Connected” notification appears

The server did not disconnect this client because of a heartbeat timeout.

The reported RTT is the browser’s network estimate, not a measurement of the actual peer-to-peer transfer latency. These logs establish the reconnect sequence but do not establish why the browser updated its estimate.

Relevant code

The current event handler reconnects whenever connection information changes:

javascript
if (navigator.connection) {
    navigator.connection.addEventListener('change', _ => this._reconnect());
}

_reconnect() unconditionally disconnects the existing socket:

javascript
_reconnect() {
    this._disconnect();
    this._connect();
}

A NetworkInformation change event can reflect updated network estimates, so this can interrupt a working connection even without an actual loss of connectivity.

Expected behavior

Changes in estimated network quality should not interrupt an active transfer while the existing connection remains usable.

Proposed fix / question

Would it be appropriate to call the existing _connect() method instead?

javascript
if (navigator.connection) {
    navigator.connection.addEventListener('change', _ => this._connect());
}

_connect() already returns early when the WebSocket is connected or connecting. Existing close-event and online-event handling would remain in place.

Was the unconditional reconnect introduced to address a specific network-switching or browser compatibility scenario? Could replacing it with _connect() cause problems—for example, when a stale socket still reports OPEN after a real network change?

Related issues

These discuss similar symptoms or connection recovery. This report specifically identifies an unnecessary disconnect triggered by a NetworkInformation change during an active transfer.