aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Transport/Discovery/IDiscoveryClient.cs
blob: 4bc992d77fdf5545d093d88b21390483b58e68c0 (plain)
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
using Google.Protobuf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Transport.Discovery
{
    /// <summary>
    /// Represents a discovery service client.
    /// </summary>
    /// <typeparam name="DiscoveryMessage">The type of the discovery message.</typeparam>
    /// <seealso cref="Tango.Transport.Discovery.IDiscoveryComponent" />
    public interface IDiscoveryClient<DiscoveryMessage> : IDiscoveryComponent where DiscoveryMessage : IMessage
    {
        /// <summary>
        /// Occurs when a matching service has been discovered.
        /// </summary>
        event EventHandler<DiscoveredService<DiscoveryMessage>> ServiceDiscovered;

        /// <summary>
        /// Asynchronous method for awaiting until the service will be discovered.
        /// </summary>
        /// <returns></returns>
        Task<DiscoveredService<DiscoveryMessage>> Discover(TimeSpan? timeout = null);
    }
}