Skip to content

Overview & Architecture

What is TopBridge

TopBridge is a desktop application running on the user's local machine (referred to as "TopBridge App"). It manages label printers, templates, and user entitlements. It exposes APIs via the WebSocket protocol locally, allowing browser applications to send print commands.

Download: Get TopBridge App

Looking for a complete solution?

Visit the TOPSALE label printing website to learn more about our fully managed platform.

What Problems Does the SDK Solve

@appzgatenz/label-print-topbridge-js is a Headless (no UI) browser SDK that encapsulates all communication details with TopBridge App:

  • Hybrid WebSocket management — Lightweight APIs and push events share one persistent connection; print jobs keep an independent short connection
  • TopBridge App launch & retry — Launch orchestration via the launch module with automatic retry logic
  • Data transformation — Automatically converts product data into the structured format required by TopBridge App based on template schema
  • Structured errors — 14 error classes (1 base + 13 subclasses), all supporting instanceof narrowing
  • Preflight orchestration — One-liner to complete "health check → entitlement validation → printer discovery"
  • Printer setup & session unblock — Configure protocols / BPAC and clear SessionBlocked via printerSetup / session
  • Push events — Subscribe to printer, template, user, and connection lifecycle events via client.events

The SDK is not bound to any UI framework and can be used in React / Vue / Svelte / vanilla JS.

Architecture Overview

Your Browser Application


TopBridgeClient (SDK Entry)
    ├── health         Health check
    ├── whoami         Current login status
    ├── benefits       Entitlement & quota (+ refreshBenefit)
    ├── printers       Printer list
    ├── templates      Template list / schema / json / refresh
    ├── print          Print execution (schema-driven conversion)
    ├── preflight      Orchestration: health → benefits → printers
    ├── launch         TopBridge App launch + retry
    ├── printerSetup   Printer configuration & BPAC
    ├── session        Session-limit unblock (kickSession)
    └── events         Push events + connection lifecycle

    ▼  WebSocket (default ws://localhost:8765/v2; optional fixed WSS)
TopBridge App (Local Desktop Application)


Label Printer

How It Works

  1. Initialize — Create a TopBridgeClient instance in your browser app
  2. Preflight — Run health check, validate entitlements, and discover printers
  3. Optional setup — Configure printers / handle session limits when required
  4. Print — Submit a print request with product data; the SDK fetches the template schema and transforms the data
  5. Optional events — Subscribe to Tray App push events on the shared connection

You only interact with the high-level module API — no need to manage raw WebSocket frames or protocol message formats.

SDK Modules

ModuleAccessDescription
healthclient.healthTopBridge App health check
whoamiclient.whoamiCurrent login status and account
benefitsclient.benefitsEntitlement validation + force refresh
printersclient.printersSynced printer list
templatesclient.templatesTemplate list, schema, JSON batch, refresh
printclient.printExecute label print with auto data conversion
preflightclient.preflightOrchestration: health → benefits → printers
launchclient.launchTopBridge App launch and retry
printerSetupclient.printerSetupPrinter protocol / charset / font / BPAC
sessionclient.sessionKick sessions to clear SessionBlocked
eventsclient.eventsTyped on / off subscriptions

Lifecycle helpers on the client: connect(), close(), getConnectionState().

Package Info

PropertyValue
Package@appzgatenz/label-print-topbridge-js
Size~9 KB gzipped
DependenciesZero runtime dependencies
FormatsESM + CJS dual output
Tree-shakingSupported (sideEffects: false)
Node.js>= 18