Moodle for mobile

Problems with core_message_get_message

 
Picture of Dani Palou
Re: Problems with core_message_get_message
Core developersMoodle HQParticularly helpful MoodlersPlugin developers

Hi Howard,

that WebService is used in the following cases:

  • Viewing notifications in the app. The WebService is called twice: one for read notifications and another one for unread notifications.
  • If your site is older than 3.2, this WS is also used to calculate the number of unread notifications (to show the badge in the app). This is called in several cases: when the app is started, when some notifications are marked as read, or every certain time (10 minutes in mobile, 1 minute in desktop).
  • Viewing the list of message conversations in the app. This will be improved on Moodle 3.6, but right now we need to call the WebService 4 times to be able to build the list of discussions, since we need different parameters to retrieve read/unread messages and to retrieve sent/received messages.
  • Viewing a discussion. This calls the WS several times too.
  • As before, if your site is older than 3.2 this WS is also used to calculate the number of unread messages (to show the badge in the app). The cases are similar to the ones for notifications.

So it could happen that, if the process to check unread notifications & messages are executed at the same time as viewing the list of discussions and viewing a discussion, you could have like 10 requests in a row, but not 30! Of course, the user could have the same account in different devices, but it could be strange that all requests happen at the same time (unless he has a lot of devices, but that's unlikely).

You should check the parameters of the requests, maybe they give you some clues on what is going on. IMO the most important ones are:

  • type: whether to retrieve notifications, messages or both.
  • useridto and useridfrom: the user sending and receiving the messages.
  • read: whether the messages are read or unread.

In Moodle 3.6, messaging is being refactored so hopefully we'll be able to reduce the number of WebService calls.

Cheers,

Dani


 
Average of ratings: -