-
Notifications
You must be signed in to change notification settings - Fork 0
/
IMqttConnectable.cs
43 lines (39 loc) · 1.64 KB
/
IMqttConnectable.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
using System.Threading.Tasks;
using TeleScope.Connectors.Abstractions;
namespace TeleScope.Connectors.Mqtt.Abstractions
{
/// <summary>
/// This interface provides extended methods, based on the interfaces `IConnectable` and `IAsyncConnectable`
/// in order to build mqtt connections to external brokers.
/// </summary>
public interface IMqttConnectable : IConnectable, IAsyncConnectable
{
/// <summary>
/// Subscribes to a new topic that the client will listen to.
/// </summary>
/// <param name="topic">The topic of interest.</param>
/// <returns>The calling instance.</returns>
IMqttConnectable Subscribe(string topic);
/// <summary>
/// Unsubscribes from a topic that the client will no longer listen to.
/// </summary>
/// <param name="topic">The topic that will be removed.</param>
/// <returns>The calling instance.</returns>
IMqttConnectable Unsubscribe(string topic);
/// <summary>
/// Sends a message string asynchronously to a given broker.
/// </summary>
/// <param name="topic">The topic of the message.</param>
/// <param name="message">The message that will be sent.</param>
/// <returns>The executing task.</returns>
Task PublishAsync(string topic, string message);
/// <summary>
/// Sends a message string asynchronously to a given broker.
/// </summary>
/// <param name="topic">The topic of the message.</param>
/// <param name="message">The message that will be sent.</param>
/// <param name="qualityOfService">The level of quality that will be used for sending.</param>
/// <returns>The executing task.</returns>
Task PublishAsync(string topic, string message, int qualityOfService);
}
}