Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ WebSocketProtocolComponent()

static System.Net.WebSockets.WebSocketProtocolComponent.WebSocketProtocolComponent ( )
inlinestaticprivate

Definition at line 68 of file WebSocketProtocolComponent.cs.

69 {
70 s_dummyWebsocketKeyBase64 = Convert.ToBase64String(new byte[16]);
71 s_initialClientRequestHeaders = new global::Interop.WebSocket.HttpHeader[2]
72 {
73 new global::Interop.WebSocket.HttpHeader
74 {
75 Name = "Connection",
76 NameLength = (uint)"Connection".Length,
77 Value = "Upgrade",
78 ValueLength = (uint)"Upgrade".Length
79 },
80 new global::Interop.WebSocket.HttpHeader
81 {
82 Name = "Upgrade",
83 NameLength = (uint)"Upgrade".Length,
84 Value = "websocket",
85 ValueLength = (uint)"websocket".Length
86 }
87 };
88 s_webSocketDllHandle = global::Interop.Kernel32.LoadLibraryEx("websocket.dll", IntPtr.Zero, 0);
89 if (!(s_webSocketDllHandle == IntPtr.Zero))
90 {
92 s_ServerFakeRequestHeaders = new global::Interop.WebSocket.HttpHeader[5]
93 {
94 new global::Interop.WebSocket.HttpHeader
95 {
96 Name = "Connection",
97 NameLength = (uint)"Connection".Length,
98 Value = "Upgrade",
99 ValueLength = (uint)"Upgrade".Length
100 },
101 new global::Interop.WebSocket.HttpHeader
102 {
103 Name = "Upgrade",
104 NameLength = (uint)"Upgrade".Length,
105 Value = "websocket",
106 ValueLength = (uint)"websocket".Length
107 },
108 new global::Interop.WebSocket.HttpHeader
109 {
110 Name = "Host",
111 NameLength = (uint)"Host".Length,
112 Value = string.Empty,
113 ValueLength = 0u
114 },
115 new global::Interop.WebSocket.HttpHeader
116 {
117 Name = "Sec-WebSocket-Version",
118 NameLength = (uint)"Sec-WebSocket-Version".Length,
119 Value = s_supportedVersion,
120 ValueLength = (uint)s_supportedVersion.Length
121 },
122 new global::Interop.WebSocket.HttpHeader
123 {
124 Name = "Sec-WebSocket-Key",
125 NameLength = (uint)"Sec-WebSocket-Key".Length,
127 ValueLength = (uint)s_dummyWebsocketKeyBase64.Length
128 }
129 };
130 }
131 }
static readonly global::Interop.WebSocket.HttpHeader[] s_initialClientRequestHeaders
static readonly global::Interop.WebSocket.HttpHeader[] s_ServerFakeRequestHeaders

References System.Net.WebSockets.WebSocketProtocolComponent.GetSupportedVersion(), System.Name, System.Net.WebSockets.WebSocketProtocolComponent.s_dummyWebsocketKeyBase64, System.Net.WebSockets.WebSocketProtocolComponent.s_initialClientRequestHeaders, System.Net.WebSockets.WebSocketProtocolComponent.s_ServerFakeRequestHeaders, System.Net.WebSockets.WebSocketProtocolComponent.s_supportedVersion, System.Net.WebSockets.WebSocketProtocolComponent.s_webSocketDllHandle, System.Convert.ToBase64String(), and System.IntPtr.Zero.