Retrieve message history from a given time

Not sure if this is possible, but is there a way to retrieve messages from a given time?

For Example, I provide a date and then the server retrieves messages around that time and sends them to the client.

@SirBuildsALot That’s not possible. The message history is stored and retrieved with range queries. The API returns a cacheable cursor which can be used to fetch history forwards of a particular point since the last message history was returned. You can also page backwards from the most recent message history. This is how most messaging APIs work like WhatsApp or Telegram.

Why do you want to search for messages at a particular datetime? Can you show me an example of this done in a game?

Sure, well for the report review system in my game, I’m trying to have it lookup messages around the time of the report so that the person reviewing it can get more information on the situation.

But because there is no way to do this currently, I’ll probably just have the server save messages up to a certain time and if a user reports someone those messages will be included in the report.

Also is it possible to have the server read messages being sent with lua? I couldn’t find anything in the docs on it.

1 Like

@SirBuildsALot This sounds like a good use case to me. Please can you open a feature request on the game server and we’ll see if there’s an optimal way to start the cursor somewhere within the message history at the offset specified for the input datetime.

Also is it possible to have the server read messages being sent with lua? I couldn’t find anything in the docs on it.

There is no function in the runtime framework to do that. It’s simply never been requested before and so without a use case for it we’ve not added it to be called server-side.

Okay, so do I just post a feature request here, or do I open one somewhere else?

@SirBuildsALot The codebase is open-source on GitHub so you can open a feature request on the issue tracker: github.com/heroiclabs/nakama

@novabyte Thanks, the feature has now been requested.

1 Like