Building a Chat System – Part 3
If you’ve been following my series on building a chat system inside a mobile app, you’ve seen as I set up my Ionic framework and created a user in Azure Chat. Now it’s time to build the ability to store message data.
We wouldn’t need to necessarily store all messages, but by doing so we can do some analytics and see what’s trending in the messages. Also, Azure Chat only stores messages for 90 days, and we might want a longer message history.
For this, we will store the messages in Azure Table storage.
Storing data into Azure Table storage is straightforward. We need to create a Table Client and call createEntity
.
Creating a table client is simple.
And logging messages into table storage is a single method call too.
Now we have messages being stored in Azure Table storage.
Tracking all of the messages in a table will enable the query and export of this data.
Here’s the full source for ChatStorage.