forked from andremussche/DelphiWebsockets
-
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Journeyman.WebSocket.Interfaces.pas
82 lines (75 loc) · 3.61 KB
/
Journeyman.WebSocket.Interfaces.pas
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
unit Journeyman.WebSocket.Interfaces;
interface
uses
System.Classes, IdGlobal, IdSocketHandle, IdBuffer, Journeyman.WebSocket.Types,
System.SysUtils;
type
{$IF CompilerVersion >= 26} // XE5
TIdTextEncoding = IIdTextEncoding;
{$ENDIF}
ISetWebSocketClosing = interface
['{7EB09E63-DF10-472E-8B1C-DAB7EAE2164E}']
procedure SetWebSocketClosing(const AValue: TOnWebSocketClosing);
end;
IIOHandlerWebSocket = interface
['{6F5E19B2-7D2D-436D-B5A7-063C2B4E59B8}']
function CheckForDataOnSource(ATimeout: Integer = 0): Boolean;
procedure CheckForDisconnect(ARaiseExceptionIfDisconnected: Boolean;
AIgnoreBuffer: Boolean);
procedure Clear;
procedure Close;
procedure CloseWithReason(const AReason: string);
function GetBinding: TIdSocketHandle;
function GetBusyUpgrading: Boolean;
function GetClosedGracefully: Boolean;
function GetCloseReason: string;
function GetConnected: Boolean;
function GetInputBuffer: TIdBuffer;
function GetIsWebSocket: Boolean;
function GetLastPingTime: TDateTime;
function GetLastActivityTime: TDateTime;
function GetOnNotifyClosed: TProc;
function GetOnNotifyClosing: TProc;
function HasData: Boolean;
procedure Lock;
function ReadLongWord(AConvert: Boolean = True): UInt32;
procedure ReadStream(AStream: TStream; AByteCount: TIdStreamSize = -1;
AReadUntilDisconnect: Boolean = False);
function Readable(AMSec: Integer = IdTimeoutDefault): Boolean;
function ReadUInt32(AConvert: Boolean = True): UInt32;
procedure SetBusyUpgrading(const Value: Boolean);
procedure SetClosedGracefully(const Value: Boolean);
procedure SetCloseReason(const AReason: string);
procedure SetIsWebSocket(const Value: Boolean);
procedure SetLastActivityTime(const Value: TDateTime);
procedure SetLastPingTime(const Value: TDateTime);
procedure SetOnNotifyClosed(const Value: TProc);
procedure SetOnNotifyClosing(const Value: TProc);
procedure SetUseNagle(const Value: Boolean);
function TryLock: Boolean;
procedure Unlock;
procedure Write(const ABuffer: TIdBytes; const ALength: Integer = -1;
const AOffset: Integer = 0); overload;
procedure Write(const AOut: string; AEncoding: TIdTextEncoding = nil); overload;
procedure Write(AStream: TStream; AType: TWSDataType); overload;
procedure WriteBin(const ABytes: TArray<Byte>);
function WriteData(const AData: TIdBytes; AType: TWSDataCode;
aFIN: boolean = true; aRSV1: boolean = false; aRSV2: boolean = false;
aRSV3: boolean = false): integer;
procedure WriteLn(AEncoding: IIdTextEncoding = nil); overload;
procedure WriteLn(const AOut: string; AByteEncoding: IIdTextEncoding = nil); overload;
property Binding: TIdSocketHandle read GetBinding;
property BusyUpgrading: Boolean read GetBusyUpgrading write SetBusyUpgrading;
property ClosedGracefully: Boolean read GetClosedGracefully write SetClosedGracefully;
property CloseReason: string read GetCloseReason write SetCloseReason;
property Connected: Boolean read GetConnected;
property InputBuffer: TIdBuffer read GetInputBuffer;
property IsWebSocket: Boolean read GetIsWebSocket write SetIsWebSocket;
property LastActivityTime: TDateTime read GetLastActivityTime write SetLastActivityTime;
property LastPingTime: TDateTime read GetLastPingTime write SetLastPingTime;
property OnNotifyClosed: TProc read GetOnNotifyClosed write SetOnNotifyClosed;
property OnNotifyClosing: TProc read GetOnNotifyClosing write SetOnNotifyClosing;
property UseNagle: Boolean write SetUseNagle;
end;
implementation
end.