Overview
APM can broadcast real-time weight readings from connected scales to subscribed WebSocket clients. This is useful for point-of-sale systems that need to weigh products during checkout.Start Listening
Subscribe to scale data updates from a specific scale.Message Format
Request Fields
Must be
StartListening to subscribe to scale readings.Identifier of the scale to listen to. Must match a scale ID configured in APM.
Stop Listening
Unsubscribe from scale data updates.Message Format
Request Fields
Must be
StopListening to unsubscribe from scale readings.The scale ID is automatically determined from your client’s active subscription. Each client can only subscribe to one scale at a time.
Scale Reading Broadcast
When subscribed, APM automatically sends weight readings as they change.Message Format
Broadcast Fields
Event type identifier. Always
SCALE_READING for scale data.Identifier of the station where the scale is connected.
Identifier of the scale that produced this reading.
The measured weight value.
Unit of measurement:
kg (kilograms), g (grams), or lb (pounds).Indicates if the weight reading is stable.
true means the weight has stabilized and is ready to be recorded.ISO 8601 timestamp of when the reading was taken.
Example: Complete Scale Flow
Subscription Behavior
- Per-Client Subscriptions: Each WebSocket client maintains its own scale subscription
- Single Scale Per Client: A client can only subscribe to one scale at a time. Starting a new subscription automatically stops the previous one
- Automatic Cleanup: When a client disconnects, APM automatically stops listening to the scale and cleans up the subscription
- Broadcast to Subscribers: Scale readings are only sent to clients that have subscribed to that specific scale
Scale Configuration
Scales must be configured in APM before they can be used. See the configuration documentation for details on:- Adding scale devices
- Configuring serial ports
- Setting up scale protocols
- Calibration and units
Common Use Cases
Fresh Produce Weighing
Continuous Monitoring
Troubleshooting
No Scale Readings
- Verify the scale is configured in APM
- Check the scale ID matches your configuration
- Ensure the scale is connected and powered on
- Check the status endpoint:
http://localhost:7000/websocket/status
Unstable Readings
- Wait for
Stable: truebefore capturing weight - Ensure the scale is on a level surface
- Remove vibrations or air currents near the scale
- Check scale calibration
Source Reference
- Scale data model:
source/Core/Models/ScaleData.cs:9 - WebSocket handler:
source/Infraestructure/Services/WebSocketServerService.cs:444 - Scale service integration:
source/Infraestructure/Services/WebSocketServerService.cs:80