Skip to main content

📞 Callback Description

đŸ“ĸ OpenIM offers a robust callback functionality. When a specific event occurs, either before or after it happens, OpenIMServer proactively notifies the APP's business server via HTTP/HTTPS requests. This way, the APP's business server can intervene in the subsequent process of the event or synchronize data based on these callbacks.

📑 Callback Categories​

Based on the timing of processing, callbacks are divided into two main categories:

  • đŸšĢ Callbacks before the event is sent: This type of callback (before type) aims to let the APP's business server intervene in event processing, such as filtering sensitive words in a message. OpenIMServer will determine the subsequent process based on the callback's return.

  • 📤 Notifications after the event is sent: This type of callback (after type) is primarily used to notify the APP's business server to synchronize data, for example, when a user joins a group. At this point, OpenIMServer will ignore the callback's return and error codes.

⚙ī¸ Configuration Description​

callback:
url:
beforeCreateGroup:
enable: false
timeout: 5
failedContinue: true
  • url: Callback address of the APP's business server, supporting HTTP/HTTPS
  • enable: Whether to enable this callback
  • timeout: Response timeout duration (in seconds)
  • failedContinue: Whether to continue the process after timeout or API failure, generally effective only for the "before" type of callback.

🔄 Callback Protocol​

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