Skip to content

Commit 13fd850

Browse files
author
yinlong
committed
添加 websocket-sharp 插件 源码 modify
1 parent c510cc9 commit 13fd850

File tree

178 files changed

+34108
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

178 files changed

+34108
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Ignore build results and temporary files.
2+
3+
Backup*
4+
_UpgradeReport_Files
5+
bin
6+
obj
7+
8+
*.mdb
9+
*.pdb
10+
*.pidb
11+
*.suo
12+
*.user
13+
*.userprefs
14+
UpgradeLog*.*
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
4+
// Information about this assembly is defined by the following attributes.
5+
// Change them to the values specific to your project.
6+
7+
[assembly: AssemblyTitle("websocket-sharp")]
8+
[assembly: AssemblyDescription("A C# implementation of the WebSocket protocol client and server")]
9+
[assembly: AssemblyConfiguration("")]
10+
[assembly: AssemblyCompany("")]
11+
[assembly: AssemblyProduct("websocket-sharp.dll")]
12+
[assembly: AssemblyCopyright("sta.blockhead")]
13+
[assembly: AssemblyTrademark("")]
14+
[assembly: AssemblyCulture("")]
15+
16+
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
17+
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
18+
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
19+
20+
[assembly: AssemblyVersion("1.0.2.*")]
21+
22+
// The following attributes are used to specify the signing key for the assembly,
23+
// if desired. See the Mono documentation for more information about signing.
24+
25+
//[assembly: AssemblyDelaySign(false)]
26+
//[assembly: AssemblyKeyFile("")]

UnityWebSocket/Assets/Scripts/Plugins/UnityWebSocket/websocket-sharp/AssemblyInfo.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#region License
2+
/*
3+
* ByteOrder.cs
4+
*
5+
* The MIT License
6+
*
7+
* Copyright (c) 2012-2015 sta.blockhead
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
#endregion
28+
29+
using System;
30+
31+
namespace WebSocketSharp
32+
{
33+
/// <summary>
34+
/// Specifies the byte order.
35+
/// </summary>
36+
public enum ByteOrder
37+
{
38+
/// <summary>
39+
/// Specifies Little-endian.
40+
/// </summary>
41+
Little,
42+
/// <summary>
43+
/// Specifies Big-endian.
44+
/// </summary>
45+
Big
46+
}
47+
}

UnityWebSocket/Assets/Scripts/Plugins/UnityWebSocket/websocket-sharp/ByteOrder.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
#region License
2+
/*
3+
* CloseEventArgs.cs
4+
*
5+
* The MIT License
6+
*
7+
* Copyright (c) 2012-2016 sta.blockhead
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
#endregion
28+
29+
using System;
30+
31+
namespace WebSocketSharp
32+
{
33+
/// <summary>
34+
/// Represents the event data for the <see cref="WebSocket.OnClose"/> event.
35+
/// </summary>
36+
/// <remarks>
37+
/// <para>
38+
/// That event occurs when the WebSocket connection has been closed.
39+
/// </para>
40+
/// <para>
41+
/// If you would like to get the reason for the close, you should access
42+
/// the <see cref="Code"/> or <see cref="Reason"/> property.
43+
/// </para>
44+
/// </remarks>
45+
public class CloseEventArgs : EventArgs
46+
{
47+
#region Private Fields
48+
49+
private bool _clean;
50+
private PayloadData _payloadData;
51+
52+
#endregion
53+
54+
#region Internal Constructors
55+
56+
internal CloseEventArgs ()
57+
{
58+
_payloadData = PayloadData.Empty;
59+
}
60+
61+
internal CloseEventArgs (ushort code)
62+
: this (code, null)
63+
{
64+
}
65+
66+
internal CloseEventArgs (CloseStatusCode code)
67+
: this ((ushort) code, null)
68+
{
69+
}
70+
71+
internal CloseEventArgs (PayloadData payloadData)
72+
{
73+
_payloadData = payloadData;
74+
}
75+
76+
internal CloseEventArgs (ushort code, string reason)
77+
{
78+
_payloadData = new PayloadData (code, reason);
79+
}
80+
81+
internal CloseEventArgs (CloseStatusCode code, string reason)
82+
: this ((ushort) code, reason)
83+
{
84+
}
85+
86+
#endregion
87+
88+
#region Internal Properties
89+
90+
internal PayloadData PayloadData {
91+
get {
92+
return _payloadData;
93+
}
94+
}
95+
96+
#endregion
97+
98+
#region Public Properties
99+
100+
/// <summary>
101+
/// Gets the status code for the close.
102+
/// </summary>
103+
/// <value>
104+
/// A <see cref="ushort"/> that represents the status code for the close if any.
105+
/// </value>
106+
public ushort Code {
107+
get {
108+
return _payloadData.Code;
109+
}
110+
}
111+
112+
/// <summary>
113+
/// Gets the reason for the close.
114+
/// </summary>
115+
/// <value>
116+
/// A <see cref="string"/> that represents the reason for the close if any.
117+
/// </value>
118+
public string Reason {
119+
get {
120+
return _payloadData.Reason ?? String.Empty;
121+
}
122+
}
123+
124+
/// <summary>
125+
/// Gets a value indicating whether the connection has been closed cleanly.
126+
/// </summary>
127+
/// <value>
128+
/// <c>true</c> if the connection has been closed cleanly; otherwise, <c>false</c>.
129+
/// </value>
130+
public bool WasClean {
131+
get {
132+
return _clean;
133+
}
134+
135+
internal set {
136+
_clean = value;
137+
}
138+
}
139+
140+
#endregion
141+
}
142+
}

UnityWebSocket/Assets/Scripts/Plugins/UnityWebSocket/websocket-sharp/CloseEventArgs.cs.meta

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#region License
2+
/*
3+
* CloseStatusCode.cs
4+
*
5+
* The MIT License
6+
*
7+
* Copyright (c) 2012-2016 sta.blockhead
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25+
* THE SOFTWARE.
26+
*/
27+
#endregion
28+
29+
using System;
30+
31+
namespace WebSocketSharp
32+
{
33+
/// <summary>
34+
/// Indicates the status code for the WebSocket connection close.
35+
/// </summary>
36+
/// <remarks>
37+
/// <para>
38+
/// The values of this enumeration are defined in
39+
/// <see href="http://tools.ietf.org/html/rfc6455#section-7.4">
40+
/// Section 7.4</see> of RFC 6455.
41+
/// </para>
42+
/// <para>
43+
/// "Reserved value" cannot be sent as a status code in
44+
/// closing handshake by an endpoint.
45+
/// </para>
46+
/// </remarks>
47+
public enum CloseStatusCode : ushort
48+
{
49+
/// <summary>
50+
/// Equivalent to close status 1000. Indicates normal close.
51+
/// </summary>
52+
Normal = 1000,
53+
/// <summary>
54+
/// Equivalent to close status 1001. Indicates that an endpoint is
55+
/// going away.
56+
/// </summary>
57+
Away = 1001,
58+
/// <summary>
59+
/// Equivalent to close status 1002. Indicates that an endpoint is
60+
/// terminating the connection due to a protocol error.
61+
/// </summary>
62+
ProtocolError = 1002,
63+
/// <summary>
64+
/// Equivalent to close status 1003. Indicates that an endpoint is
65+
/// terminating the connection because it has received a type of
66+
/// data that it cannot accept.
67+
/// </summary>
68+
UnsupportedData = 1003,
69+
/// <summary>
70+
/// Equivalent to close status 1004. Still undefined. A Reserved value.
71+
/// </summary>
72+
Undefined = 1004,
73+
/// <summary>
74+
/// Equivalent to close status 1005. Indicates that no status code was
75+
/// actually present. A Reserved value.
76+
/// </summary>
77+
NoStatus = 1005,
78+
/// <summary>
79+
/// Equivalent to close status 1006. Indicates that the connection was
80+
/// closed abnormally. A Reserved value.
81+
/// </summary>
82+
Abnormal = 1006,
83+
/// <summary>
84+
/// Equivalent to close status 1007. Indicates that an endpoint is
85+
/// terminating the connection because it has received a message that
86+
/// contains data that is not consistent with the type of the message.
87+
/// </summary>
88+
InvalidData = 1007,
89+
/// <summary>
90+
/// Equivalent to close status 1008. Indicates that an endpoint is
91+
/// terminating the connection because it has received a message that
92+
/// violates its policy.
93+
/// </summary>
94+
PolicyViolation = 1008,
95+
/// <summary>
96+
/// Equivalent to close status 1009. Indicates that an endpoint is
97+
/// terminating the connection because it has received a message that
98+
/// is too big to process.
99+
/// </summary>
100+
TooBig = 1009,
101+
/// <summary>
102+
/// Equivalent to close status 1010. Indicates that a client is
103+
/// terminating the connection because it has expected the server to
104+
/// negotiate one or more extension, but the server did not return
105+
/// them in the handshake response.
106+
/// </summary>
107+
MandatoryExtension = 1010,
108+
/// <summary>
109+
/// Equivalent to close status 1011. Indicates that a server is
110+
/// terminating the connection because it has encountered an unexpected
111+
/// condition that prevented it from fulfilling the request.
112+
/// </summary>
113+
ServerError = 1011,
114+
/// <summary>
115+
/// Equivalent to close status 1015. Indicates that the connection was
116+
/// closed due to a failure to perform a TLS handshake. A Reserved value.
117+
/// </summary>
118+
TlsHandshakeFailure = 1015
119+
}
120+
}

0 commit comments

Comments
 (0)