Web socket events
- On the 'Websocket events' page API Maker, the user can add, edit and delete websocket event names. These names are for reference only.
- For admin to remember the existing websocket names.
Keep In mind:
- A WebSocket notification will be sent for each successful API request.
- No WebSocket notification is sent when an error occurs before the response is generated.
- If error is thrown from Pre-hook, you will not get WebSocket notification.
- If error is thrown from Post-hook, you will get WebSocket notification.
- All the APIs that are listed in WebSocket section can send WebSocket notifications, whether they are called directly or from the Code panel of [Custom API, Pre-hook, Post-hook, Event listener] etc.
Subscribe event code
- The Front-end developer should add the below code to subscribe to the websocket event.
Subscribe/Register for the 'INSTANCES' event type.
Subscribe for the 'CUSTOM_APIS' event type.
Subscribe for the 'SYSTEM_APIS' event type.
Subscribe for the 'THIRD_PARTY_APIS' event type.
Subscribe for the 'CUSTOM_WS_EVENTS' event type.
Unregister/Unsubscribe for websocket event
- You can get the 'eventId' when you register the event.
Event Types (eventType)
- INSTANCES
- THIRD_PARTY_APIS
- CUSTOM_APIS
- SYSTEM_APIS
- CUSTOM_WS_EVENTS
API name (apiName)
Schema APIs
- SCHEMA_GET_ALL
- SCHEMA_GET_ALL_STREAM
- SCHEMA_GET_BY_ID
- SCHEMA_POST_BULK_INSERT
- SCHEMA_MASTER_SAVE
- SCHEMA_ARRAY_OPERATIONS
- SCHEMA_UPDATE_MANY
- SCHEMA_PUT_UPDATE_BY_ID
- SCHEMA_PUT_REPLACE_BY_ID
- SCHEMA_DEL_DELETE_BY_ID
- SCHEMA_POST_QUERY
- SCHEMA_POST_QUERY_STREAM
- SCHEMA_POST_QUERY_DELETE
- SCHEMA_POST_AGGREGATE
- SCHEMA_POST_COUNT
- SCHEMA_GET_DISTINCT
- SCHEMA_POST_DISTINCT_QUERY
Generated APIs
- GEN_GET_ALL
- GEN_GET_ALL_STREAM
- GEN_GET_BY_ID
- GEN_POST_BULK_INSERT
- GEN_MASTER_SAVE
- GEN_ARRAY_OPERATIONS
- GEN_UPDATE_MANY
- GEN_PUT_UPDATE_BY_ID
- GEN_PUT_REPLACE_BY_ID
- GEN_DEL_DELETE_BY_ID
- GEN_POST_QUERY
- GEN_POST_QUERY_STREAM
- GEN_POST_QUERY_DELETE
- GEN_POST_AGGREGATE
- GEN_POST_COUNT
- GEN_GET_DISTINCT
- GEN_POST_DISTINCT_QUERY
System APIs
- EXECUTE_PLAIN_QUERY
- ENCRYPT_DATA
- DECRYPT_DATA
- HASH_DATA
- GET_TOKEN
- CALL_EXTERNAL_API
- GET_SECRET
- GET_REDIS_KEY
- SET_REDIS_KEY
- REMOVE_REDIS_KEY
- CUSTOM_USER_CACHING
- RESET_REDIS_CACHE_DB
- RESET_REDIS_CACHE_CUSTOM_APIS
- RESET_REDIS_CACHE_SYSTEM_APIS
- RESET_REDIS_CACHE_TP_APIS
- GET_TABLE_META
- EMIT_EVENT
- EMIT_EVENT_WS
- IS_VALID_DATA_FOR_TABLE
- IS_VALID_DATA_FOR_CUSTOM_API
- IS_VALID_DATA_FOR_THIRD_PARTY_API
Condition
- 'conditionType' can be only 'RESPONSE' always.
- The 'criteria' contains the column-value pair which you want to add as a condition.
- When users subscribe event with the above code, they can get a notification only when the condition's criteria will be matched.
Select
- If you want to get a specific column's value in notification you can add that column name in the 'select' with value 1.
Event data
- If the 'getEventData' value is true you will get all event response data.
API bundle (apiBundleName)
- Provide the bundle name in the 'apiBundleName' field while subscribing to the third-party APIs.
API version (apiVersion)
- While subscribing the third-party API 'apiVersion' contains the version name of the API.
Developed by (developedBy)
- While subscribing the third-party API 'developed' contains the user_name of the API owner.