Connectivity API
The Connectivity API provides access to device connectivity information, allowing you to monitor Internet connection status and respond to connectivity changes in real-time. The API enables both immediate connectivity checks and dynamic updates when network conditions change.
Anchor to Use casesUse cases
- Network monitoring: Monitor connectivity and handle network interruptions during transactions.
- Status indicators: Display connectivity status to inform users about network availability.
- Queue operations: Queue API calls and sync operations when connectivity is restored.
- Retry logic: Implement retry logic for failed network operations.
Supported targets
- pos.
cart. line-item-details. action. menu-item. render - pos.
cart. line-item-details. action. render - pos.
customer-details. action. menu-item. render - pos.
customer-details. action. render - pos.
customer-details. block. render - pos.
draft-order-details. action. menu-item. render - pos.
draft-order-details. action. render - pos.
draft-order-details. block. render - pos.
exchange. post. action. menu-item. render - pos.
exchange. post. action. render - pos.
exchange. post. block. render - pos.
home. modal. render - pos.
home. tile. render - pos.
order-details. action. menu-item. render - pos.
order-details. action. render - pos.
order-details. block. render - pos.
product-details. action. menu-item. render - pos.
product-details. action. render - pos.
product-details. block. render - pos.
purchase. post. action. menu-item. render - pos.
purchase. post. action. render - pos.
purchase. post. block. render - pos.
register-details. action. menu-item. render - pos.
register-details. action. render - pos.
register-details. block. render - pos.
return. post. action. menu-item. render - pos.
return. post. action. render - pos.
return. post. block. render
Supported targets
- pos.
cart. line-item-details. action. menu-item. render - pos.
cart. line-item-details. action. render - pos.
customer-details. action. menu-item. render - pos.
customer-details. action. render - pos.
customer-details. block. render - pos.
draft-order-details. action. menu-item. render - pos.
draft-order-details. action. render - pos.
draft-order-details. block. render - pos.
exchange. post. action. menu-item. render - pos.
exchange. post. action. render - pos.
exchange. post. block. render - pos.
home. modal. render - pos.
home. tile. render - pos.
order-details. action. menu-item. render - pos.
order-details. action. render - pos.
order-details. block. render - pos.
product-details. action. menu-item. render - pos.
product-details. action. render - pos.
product-details. block. render - pos.
purchase. post. action. menu-item. render - pos.
purchase. post. action. render - pos.
purchase. post. block. render - pos.
register-details. action. menu-item. render - pos.
register-details. action. render - pos.
register-details. block. render - pos.
return. post. action. menu-item. render - pos.
return. post. action. render - pos.
return. post. block. render
Anchor to PropertiesProperties
The shopify global object provides access to the current connectivity state. Access the following properties on shopify to monitor network connectivity and respond to connectivity changes.
- Anchor to currentcurrentcurrentReadonlySignalLike<ConnectivityState>ReadonlySignalLike<ConnectivityState>requiredrequired
Provides read-only access to the current connectivity state and allows subscribing to connectivity changes. Use for implementing connectivity-aware functionality and reactive connectivity handling.
ReadonlySignalLike
Represents a reactive signal interface that provides both immediate value access and subscription-based updates. Enables real-time synchronization with changing data through the observer pattern.
- subscribe
Subscribes to value changes and calls the provided function whenever the value updates. Returns an unsubscribe function to clean up the subscription. Use to automatically react to changes in the signal's value.
(fn: (value: T) => void) => () => void - value
The current value of the signal. This property provides immediate access to the current value without requiring subscription setup. Use for one-time value checks or initial setup.
T
ConnectivityState
Represents the current Internet connectivity status of the device. Indicates whether the device is connected or disconnected from the Internet.
- internetConnected
The Internet connection status of the POS device.
ConnectivityStateSeverity
ConnectivityStateSeverity
'Connected' | 'Disconnected'Anchor to Best practicesBest practices
- Handle connectivity changes gracefully: Use the
subscribemethod to automatically adapt your extension behavior when connectivity changes. - Design for connectivity awareness: Design your extension to handle network interruptions, informing users when network-dependent features are unavailable and providing clear guidance on next steps.
- Provide clear connectivity feedback: Display connectivity status to users when it affects functionality, helping them understand why certain features may be limited or unavailable.
- Queue operations during outages: Implement queuing mechanisms for non-critical operations that can be deferred until connectivity is restored.
Anchor to LimitationsLimitations
Connectivity status reflects Internet connectivity only and may not indicate the quality or speed of the connection, which could affect API performance.