The first thing we will do is create a chat service that will be used by both the iOS and Android applications. To make the code more testable and to make it easier to replace the chat service if we want to use another provider in the future, we need to perform the following steps:
- In the Chat project, add a reference to the Chat.Messages project.
- Create a new folder in the Chat project called Services.
- Create a new interface called IChatService in the Services folder.
- Create a bool property called IsConnected.
- Create a method called SendMessage that takes Message as an argument and returns Task.
- Create a method called CreateConnection that returns Task. This method will create and start a connection to the SignalR service.
- Create a method called Dispose that returns Task. This method will be used when the app goes to sleep to ensure that the connection...