# Workflow SignalR Hub Events
Amorphie broadcasts all workflow events through the SignalR Hub when the client application requests a hub connection for workflow transitions.
## Architecture
There are three types of event sources.
* **Amorphie.Workflow Services** : All transitions, status updates, instance record updates are posted as an event.
* **Amorphie.Workflow Workers** : If the transition is based on Zeebe, Amorphie.Workflow workers (eg SetState) events are broadcast as an event.
* **Zeebe Exporter** : If the transition is based on Zeebe, Zeebe events are broadcast as an event.
Details...
* Every event type is published as different message on SignalR Hub.
## Sample Process

### Event Process
#### Client Action
**Source** : Service Call, **trx-start-fx-buy**
Payload
```jsonld!
{
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"form-data": {...}
}
```
*With the response of this service call, the client is connected to SignalR Hub.*
#### Hub Event
**Source** : Amorphie.Service
```jsonld!
{
"event": "transition-starting",
"time-stamp": "2023-03-25 11:31:39",
"state":null,
"entity":"fx-buy"
}
```
#### Hub Event
**Source** : Amorphie.Service
```jsonld!
{
"event": "transition-started",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"data": {...},
"time-stamp": "2023-03-25 11:31:39",
"state":"fx-buy-start",
"entity":"fx-buy",
"base-status":"LockedInFlow",
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-started",
"worker": "trx-worker-account-balance",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:31:39"
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-completed",
"worker": "trx-worker-account-balance",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:31:39"
}
```
if worker fails, worker-failed event publishes also.
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-failed",
"worker": "trx-worker-account-balance",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:31:39"
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-started",
"worker": "trx-worker-check-contracts",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:31:39"
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-completed",
"worker": "trx-worker-check-contracts",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:31:39"
}
```
if worker fails, worker-failed event publishes also.
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-failed",
"worker": "trx-worker-check-contracts",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:31:39"
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-started",
"worker": "set-state",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:41:39"
}
```
#### Hub Event
**Source** : Amorphie Worker, SetState
```jsonld!
{
"event": "set-state",
"state": "contract-needed",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"entity": "fx-buy",
"available-transitions": [
{
"name": "contract-approve",
"page": "contract-approve",
"form": "{...}",
}
],
"time-stamp": "2023-03-25 11:41:39",
"state":"contract-need",
"base-status":"Passive",
"data": {...},
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-completed",
"worker": "set-state",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:41:89"
}
```
**Source** : Service Call, **contract-approve**
Payload
```jsonld!
{
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"form-data": {...},
"entity-data": {...},
"route-data":{...},
"record-id":{...},
"transition":"contract-approve",
"entity":"fx-buy"
}
```
*With the response of this service call, the client is connected to SignalR Hub.*
#### Hub Event
**Source** : Amorphie.Service
```jsonld!
{
"event": "transition-starting",
"time-stamp": "2023-03-25 11:31:39",
"transition": "contract-approve",
"state":"contract-need",
"base-status":"Passive",
"data": {...},
"time-stamp": "2023-03-25 11:31:39"
}
```
#### Hub Event
**Source** : Amorphie.Service
```jsonld!
{
"event": "transition-started",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"state":"contract-need",
"base-status":"LockedInFlow",
"data": {...},
"time-stamp": "2023-03-25 11:31:39"
}
```
:::danger
Events skipped!
:::
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-started",
"worker": "set-state",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:41:39"
}
```
#### Hub Event
**Source** : Amorphie Worker, SetState
```jsonld!
{
"event": "set-state",
"state": "waiting-buy-approve",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"entity": "fx-buy",
"available-transitions": [
{
"name": "fx-buy-approve",
"page": "fx-buy-approve",
"form": "{...}",
}
],
"time-stamp": "2023-03-25 11:41:39",
"state":"waiting-buy-approve",
"base-status":"New",
"data": {...},
}
```
#### Hub Event
**Source** : Zeebe Exporter
```jsonld!
{
"event": "worker-completed",
"worker": "set-state",
"instance-id": "778fd5c7-5ab0-45b2-a38e-93fbe49f38bf",
"time-stamp": "2023-03-25 11:41:89"
}
```