#if !UNITY_WEBGL || UNITY_EDITOR
using System;
using Best.HTTP;
using Best.HTTP.Shared.PlatformSupport.Memory;
using Best.WebSockets.Implementations.Frames;
namespace Best.WebSockets.Extensions
{
///
/// Interface for websocket-extension implementations.
///
public interface IExtension : IDisposable
{
///
/// This is the first pass: here we can add headers to the request to initiate an extension negotiation.
///
///
void AddNegotiation(HTTPRequest request);
///
/// If the websocket upgrade succeded it will call this function to be able to parse the server's negotiation
/// response. Inside this function the IsEnabled should be set.
///
bool ParseNegotiation(HTTPResponse resp);
///
/// This function should return a new header flag based on the inFlag parameter. The extension should set only the
/// Rsv1-3 bits in the header.
///
byte GetFrameHeader(WebSocketFrame writer, byte inFlag);
///
/// This function will be called to be able to transform the data that will be sent to the server.
///
///
///
BufferSegment Encode(WebSocketFrame writer);
///
/// This function can be used the decode the server-sent data.
///
BufferSegment Decode(byte header, BufferSegment data);
}
}
#endif