Skip to main content

📞 Callback Explanation

đŸ“ĸ OpenIM provides a powerful callback function. When a specific event occurs, before or after, OpenIMServer proactively notifies the APP business server through HTTP/HTTPS requests. Thus, the APP business server can intervene in the subsequent process of the event or perform data synchronization based on these callbacks.

📑 Callback Classification​

Callbacks are classified into two main categories based on the timing of processing:

  • đŸšĢ Callbacks before an event occurs: These callbacks (before type) aim to let the APP business server intervene in event processing, for example, to filter sensitive words in messages. OpenIMServer will determine the subsequent process based on the callback return.

  • 📤 Notifications after an event occurs: These callbacks (after type) are mainly used to notify the APP business server to synchronize data, for example, when a user joins a group. At this time, OpenIMServer will ignore the callback return and error codes.

⚙ī¸ Configuration Explanation​

callback:
url:
beforeCreateGroup:
enable: true
timeout: 5
failedContinue: true

  • url: The callback address of the APP business server, supporting HTTP/HTTPS.
  • enable: Whether to enable this callback, true for enabled.
  • timeout: Response timeout time (seconds).
  • failedContinue: Whether to continue the process after timeout or API failure, generally only valid for before type callbacks, true for continuing the process.

🔄 Callback Protocol​

OpenIMServer uses a third-party callback mechanism based on the HTTP/HTTPS protocol. When initiating callback requests, OpenIMServer uses the POST request method to notify the APP business server. The specific content of these requests will be directly included in the request body.