Building a Chat System – Part 5
| August 8, 2023 | in
So far on our journey to build a chat system, we’ve covered setting up the Ionic framework, creating a user in Azure Chat, adding the ability to store more messages, and implementing a way to censor offensive words. Now we will cover actually interacting with Azure Chat.
Azure Chat isn’t a full-blown component you drop into your application and run away. Think of it as a series of APIs you interact with to create a chat application.
The first thing when interacting with Azure Chat is creating an instance of the chat client.
Next, I recommend setting up notifications. This will cause the chat client to call our code when someone sends us a message or we are added to a new chat.
One of the next operations needed is creating a chat thread.
Once we have a chat thread, we can send a message.
The last would be getting the list of messages to display.
You can see all of these interactions working together here: https://github.com/chadmichel/ChadChatAngular/blob/main/src/app/chat.service.ts
If all this is doing is providing a series of APIs, why not just write everything yourself? Building all of the APIs and building them to scale for a chat application could be a massive undertaking. In most cases, it’s better to build on top of something else.
Side note: If you are interested in some fun tech diving, look at the URLs used in Azure Chat, you might notice something interesting. Let me know what you find and sound off in the comments below.