Skip to main content

sos device connect

Connect device to local development server

Description

Establishes a connection between a signageOS device and the local development environment, allowing real-time testing and debugging of applets during development. Supports both local network (LAN) and forward server connections for different network configurations.

The command sets up a development server and configures the device to load the applet from the local machine, enabling hot reload and live debugging capabilities.

Usage

sos device connect [options]

Options

OptionTypeDescriptionDefault
--no-default-organizationbooleanPrevent using the defaultOrganizationUid from ~/.sosrc
--organization-uidstringOrganization UID
--device-uidstringDevice UID
--applet-uidstringApplet UID
--server-public-urlstringPublic url of local machine server. Is useful when the local machine is behind a reverse proxy.
--server-portnumberThe custom server port for local machine server. Default is detected from currently running applet server.
--forcebooleanForce start applet server even if it is already running on a different port. Kill the running server first.
--use-forward-serverbooleanUse forward server to connect to the device instead of the local network (LAN). It's useful when the device is not in the same network as the local machine.
--detachbooleanDetach the applet HTTP server process from the terminal. Useful when want to run more commands reusing the same http server for current applet.false
--forward-server-urlstringUrl of forward server to connect to the device instead of the local network (LAN).``
--hot-reloadbooleanEnable hot reload and build of appletfalse
--applet-pathstringPath to the applet file or the project folder depending on the entry file. Relative to the command or absolute.

Examples

# Connect device with basic configuration
sos device connect --device-uid device123 --applet-uid my-applet

# Connect with custom server port
sos device connect --device-uid device123 --server-port 8080

# Connect using forward server (for remote devices)
sos device connect --device-uid device123 --use-forward-server

# Connect with hot reload enabled
sos device connect --device-uid device123 --hot-reload

# Connect with custom organization
sos device connect --device-uid device123 --organization-uid org456

# Connect with custom public URL
sos device connect --device-uid device123 --server-public-url https://my-domain.com

# Connect and run in background
sos device connect --device-uid device123 --detach

# Force connection (terminate existing servers)
sos device connect --device-uid device123 --force

Advanced Usage

Prerequisites

Before connecting a device:

  1. Build and upload applet: The applet must be built and uploaded to the platform at least once
  2. Device configuration: Ensure the device is properly configured and accessible
  3. Network access: Device should be accessible via local network or use --use-forward-server for remote access

Development Workflow

# Typical development workflow
sos applet generate --name my-applet
cd my-applet
npm run build
sos applet upload
sos device connect --device-uid device123 --hot-reload

Network Considerations

  • Local Network (LAN): Default behavior, requires device and development machine on same network
  • Forward Server: Use --use-forward-server when device is remote or behind different network
  • Custom Forward Server: Override with --forward-server-url for private deployments
  • Public URL: Set --server-public-url when behind reverse proxy or custom domain

Configuration Tips

# Update package.json with applet UID when created
sos device connect --device-uid device123 --update-package-config

# Use custom ports for development
sos device connect --device-uid device123 --server-port 8080

# Run server in background for multiple sessions
sos device connect --device-uid device123 --detach

Since

0.9.0

Global Options

All commands support the following global options:

OptionAliasDescription
--help-hDisplay help information for any command
--version-vDisplay the installed version of the CLI
--api-url-uOverride the API URL for REST requests
--profileUse a specific profile from ~/.sosrc config

Examples

# Show version
sos --version

# Get help for any command
sos applet --help
sos applet upload --help

# Use custom API endpoint
sos --api-url https://api.example.com applet upload

# Use specific profile
sos --profile production organization list

See Also