forked from oising/Nivot.SignalR.Client.Net35
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIWebSocket.cs
More file actions
44 lines (38 loc) · 1.42 KB
/
Copy pathIWebSocket.cs
File metadata and controls
44 lines (38 loc) · 1.42 KB
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
using System;
using System.Threading.Tasks;
namespace Microsoft.AspNet.SignalR.Client.WebSockets
{
internal interface IWebSocket
{
/// <summary>
/// Invoked when data is sent over the websocket
/// </summary>
Action<string> OnMessage { get; set; }
/// <summary>
/// Invoked when the websocket closes
/// </summary>
Action OnClose { get; set; }
/// <summary>
/// Invoked when there is an error
/// </summary>
Action<Exception> OnError { get; set; }
/// <summary>
/// Sends data over the websocket.
/// </summary>
/// <param name="connection"></param>
/// <param name="value">The value to send.</param>
/// <returns>A <see cref="Task"/> that represents the send is complete.</returns>
Task Send(IConnection connection, string value);
/// <summary>
/// Sends a chunk of data over the websocket ("endOfMessage" flag set to false.)
/// </summary>
/// <param name="message"></param>
/// <returns>A <see cref="Task"/> that represents the send is complete.</returns>
Task SendChunk(ArraySegment<byte> message);
/// <summary>
/// Sends a zero byte data chunk with the "endOfMessage" flag set to true.
/// </summary>
/// <returns>A <see cref="Task"/> that represents the flush is complete.</returns>
Task Flush();
}
}