Creating the chat service

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 will follow these steps:

  1. In the Chat project, add a reference to the Chat.Messages project.
  2. Create a new folder in the Chat project called Services.
  3. Create a new interface called IChatService in the Services folder.
  4. Create a bool property called IsConnected.
  5. Create a method called SendMessage that takes Message as an argument and returns Task.
  6. Create a method called CreateConnection that returns Task. The method will create and start a connection to the SignalR service. ...

Get Xamarin.Forms Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.