All communication on websockets is done with STOMP protocol.
In all cases client application needs to establish websocket/stomp connection on url: {ORDERING_STACK_API_URL}/ws
using connection header login
containing valid access token (the same which is used for accessing Ordering Stack API, can be aquired with /auth-oauth2/oauth/token endpoint).
Client application can subscribe to:
/order-changes/{user-uuid}/{order-uuid}
.
For this subscription client will receive messages regarding order (specified with order-uuid). Subscribing users can be order creator or other user who aquired access to this order.
Example notification message:
{
"type": "OrderEventError",
"users": [
"2de9a0c3-4b21-407c-83d1-031ea0735eb2"
],
"orderId": "8f3f21b6-ac99-4918-b5dd-69add27ba3d1",
"event": {
"correlationId": "ce13772d-af4d-449e-bfac-da476ffc996b",
"user": "2de9a0c3-4b21-407c-83d1-031ea0735eb2",
"orderId": "8f3f21b6-ac99-4918-b5dd-69add27ba3d1"
},
"message": "Order cannot be abandoned",
"codes": [
{
"code": "cannotAbandon",
"message": "Order cannot be abandoned",
"args": null
}
]
}
Client application can subscribe to:
/kds/{tenantId}/{venueId}
.
For this subscription client will receive messages regarding completed but not closed orders for this venue. Notification will arrive when new completed order will appear, when this order is modified (status, other changes) and when is closed.
Client application can subscribe to:
/kds/{tenantId}/{user-uuid}
.
All messages reveived with this subscription are user specific (user_uuid is received from /auth-oauth2/oauth/token). For this subscription client will receive messages regarding user activity. It can be errors (for example user sent command to add product to the basket that can not be added), basket updates, upsells and other messages.
Client application can subscribe to:
/venue/{tenantId}/{venueId}
.
Client will receive messages when venue configuration changes including venue device changes.
Example usage of websocket notifications can be found in example POS integrator application: https://github.com/orderingstack/pos-integrator-example .