/
ITransport.cs
63 lines (54 loc) · 2.37 KB
/
ITransport.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Microsoft.AspNet.SignalR.Infrastructure;
using Microsoft.AspNet.SignalR.Hosting;
using System.Diagnostics.CodeAnalysis;
namespace Microsoft.AspNet.SignalR.Transports
{
/// <summary>
/// Represents a transport that communicates
/// </summary>
public interface ITransport
{
/// <summary>
/// Gets or sets a callback that is invoked when the transport receives data.
/// </summary>
Func<string, Task> Received { get; set; }
/// <summary>
/// Gets or sets a callback that is invoked when the initial connection connects to the transport.
/// </summary>
Func<Task> Connected { get; set; }
/// <summary>
/// Gets or sets a callback that is invoked when the transport reconnects.
/// </summary>
Func<Task> Reconnected { get; set; }
/// <summary>
/// Gets or sets a callback that is invoked when the transport disconnects.
/// </summary>
Func<bool, Task> Disconnected { get; set; }
/// <summary>
/// Gets or sets the connection id for the transport.
/// </summary>
string ConnectionId { get; set; }
/// <summary>
/// Get groupsToken in request over the transport.
/// </summary>
/// <returns>groupsToken in request</returns>
[SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate", Justification = "This is for async.")]
Task<string> GetGroupsToken();
/// <summary>
/// Processes the specified <see cref="ITransportConnection"/> for this transport.
/// </summary>
/// <param name="connection">The <see cref="ITransportConnection"/> to process.</param>
/// <returns>A <see cref="Task"/> that completes when the transport has finished processing the connection.</returns>
Task ProcessRequest(ITransportConnection connection);
/// <summary>
/// Sends data over the transport.
/// </summary>
/// <param name="value">The value to be sent.</param>
/// <returns>A <see cref="Task"/> that completes when the send is complete.</returns>
Task Send(object value);
}
}