mgth/LittleBigMouse · error · WebSocketException

The Samsung display closed the pairing channel.

Error message

The Samsung display closed the pairing channel.

What it means

Thrown by SamsungTizenClient.EnsureConnectedLockedAsync when, after connecting the WebSocket to the display's remote URI, a channel event parsed from the server reports an error or fails to reach the connected state — the TV itself dropped or refused the pairing/control channel. It indicates the display side ended the handshake, typically because the token is no longer authorized or the user denied the pairing prompt.

Solutions

  1. Re-run the Samsung pairing flow to obtain a fresh authorization token, then retry connecting.
  2. Verify the TV's device-connection settings allow this client and that no pairing request is pending or was denied.
  3. Check network reachability of the display and confirm no other client holds the exclusive remote-control session.
  4. Call ReopenAsync to rebuild the socket after the display becomes available again.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/SamsungTizen/SamsungTizenClient.cs:64 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of mgth/LittleBigMouse@7a42f01d47 (2026-09-16). Data as JSON: /api/errors/4efd64a259c7ca05. Report an issue: GitHub.

Appendix: source

Thrown at LittleBigMouse.Plugins/LittleBigMouse.Plugin.Vcp.Avalonia/SamsungTizen/SamsungTizenClient.cs:64

        try
        {
            await socket.ConnectAsync(SamsungTizenProtocol.RemoteUri(ipAddress, _token), cancellationToken)
                .ConfigureAwait(false);

            while (socket.State == WebSocketState.Open)
            {
                var message = await ReceiveTextLockedAsync(cancellationToken).ConfigureAwait(false);
                var channelEvent = SamsungTizenProtocol.ParseChannelEvent(message);
                if (!string.IsNullOrEmpty(channelEvent.Error))
                    throw PairingException(channelEvent.Error);
                if (!channelEvent.Connected) continue;

                if (!string.IsNullOrWhiteSpace(channelEvent.Token)) _token = channelEvent.Token;
                return;
            }

            throw new WebSocketException("The Samsung display closed the pairing channel.");
        }
        catch (OperationCanceledException)
        {
            ResetSocketLocked();
            throw;
        }
        catch (UnauthorizedAccessException)
        {
            ResetSocketLocked();
            throw;
        }
        catch (Exception exception)
            when (exception is WebSocketException or IOException or ObjectDisposedException)
        {
            var detail = InnermostMessage(exception);
            ResetSocketLocked();
            throw new InvalidOperationException(
                $"Could not open the Samsung remote-control channel on {ipAddress}: {detail}",

View on GitHub (pinned to 7a42f01d47)