Overview
A websocket may be set up to communicate db changes directly e.g. to a web-frontend as they happen.
Authentication
To connect, the request has to be authenticated with an api key or bearer token. As far as we could find out, adding an authentication header to the initial get request is not supported by the available JavaScript Libraries, the authentication sting has to be passed on as a cookie.
- Cookie Name: IronAPI-Auth
- Content: as no spaces are allowed, replace the space in the authentication header content for the api with a "~".
E.g.
"apikey~ke3mdieafdei3094ißfadfsa"or"Bearer~adsafjalsfjlaskjfljeoiuoru49tu304tnnlkng"
Data
A message sent from the database to the frontend will generally be a json structure with the client_id of the recipient and the data. The formatting of the data is project specific, but may look like this:
{
"client_id": 3,
"data" : {
"type": "insert",
"module": "core",
"entity": "ticket",
"instance": {"id":4, "name": "new ticket"}
}
}