WebSocket Events
Below are the available WebSocket events, their payloads, return types, and descriptions.
Event | Description | Payload | Returns |
---|---|---|---|
master:init | Creates a new master file. | { data: MasterFileDto; apiKey: string } | Promise<{ status: boolean; error?: string; data?: MasterFileDto }> |
master:update | Updates an existing master file and notifies subscribed clients. | { apiKey: string; masterFile: MasterFileDto } | Promise<{ data?: MasterFileDto; error?: string }> |
master:delete | Deletes a master file. | { apiKey: string; masterFile: MasterFileDto } | Promise<{ status?: boolean; error?: string }> |
master:get | Retrieves all master files associated with the API key. | { apiKey: string } | Promise<{ data?: MasterFileDto[]; error?: string }> |
master:getOne | Retrieves a single master file by ID or name and subscribes the client to its updates. | { apiKey: string; id?: number; name?: string } | Promise<{ data?: MasterFileDto; error?: string }> |
content:update | Updates a content file within a master file and notifies subscribed clients. | { apiKey: string; data: ContentFileDto; masterFileId: number } | Promise<{ data?: ContentFileDto; error?: string }> |
content:delete | Deletes a content file within a master file and notifies subscribed clients. | { apiKey: string; contentFile: ContentFileDto; masterFileId: number } | Promise<{ status?: boolean; error?: string }> |
content:get | Retrieves multiple content files by their IDs. | { apiKey: string; ids: number[] } | Promise<ContentFileDto[]> |
content:create | Creates a new content file within a master file. | { data: ContentFileDto; apiKey: string } | Promise<number> |
Notes:
- Payloads: The
MasterFileDto
andContentFileDto
types represent data transfer objects for master and content files, respectively. Their exact structure depends on the server implementation but typically includes fields likeid
,name
, andcontent
. - API Key: All events require an
apiKey
for authentication, obtainable from the 0 am Admin Portal. - WebSocket Connection: Events are emitted over a WebSocket connection established with the server at the default
URL (
https://api.0am.ch
), configurable via theUlda
constructor'sapiUrl
parameter. - Error Handling: Responses often include an
error
field for failure cases (e.g., invalid host, server errors). Clients should handle these gracefully.