// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.md in the project root for license information.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNet.SignalR.Hosting
{
///
/// Represents a connection to the client.
///
public interface IResponse
{
///
/// Gets a cancellation token that represents the client's lifetime.
///
CancellationToken CancellationToken { get; }
///
/// Gets or sets the status code of the response.
///
int StatusCode { get; set; }
///
/// Gets or sets the content type of the response.
///
string ContentType { get; set; }
///
/// Writes buffered data.
///
/// The data to write to the buffer.
void Write(ArraySegment data);
///
/// Flushes the buffered response to the client.
///
/// A task that represents when the data has been flushed.
Task Flush();
///
/// Closes the connection to the client.
///
/// A task that represents when the connection is closed.
[SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", MessageId = "End", Justification = "Ends the response thus the name is appropriate.")]
Task End();
}
}