// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information. using System; using System.Threading.Tasks; namespace Microsoft.AspNet.SignalR.Hosting { /// /// Represents a web socket. /// public interface IWebSocket { /// /// Invoked when data is sent over the websocket /// Action OnMessage { get; set; } /// /// Invoked when the websocket closes /// Action OnClose { get; set; } /// /// Invoked when there is an error /// Action OnError { get; set; } /// /// Sends data over the websocket. /// /// The value to send. /// A that represents the send is complete. Task Send(string value); /// /// Sends a chunk of data over the websocket ("endOfMessage" flag set to false.) /// /// /// A that represents the send is complete. Task SendChunk(ArraySegment message); /// /// Sends a zero byte data chunk with the "endOfMessage" flag set to true. /// /// A that represents the flush is complete. Task Flush(); } }