Modified WebSocket.cs

This commit is contained in:
sta 2013-03-02 16:34:38 +09:00
parent c15ac02c9b
commit acd7533c96
27 changed files with 317 additions and 271 deletions

Binary file not shown.

Binary file not shown.

View File

@ -1221,11 +1221,11 @@ namespace WebSocketSharp {
/// </exception>
public static bool TryCreateWebSocketUri(this string uriString, out Uri result, out string message)
{
if (uriString == null)
if (uriString.IsNull())
throw new ArgumentNullException("uriString");
result = null;
if (uriString == String.Empty)
if (uriString.IsEmpty())
{
message = "Must not be empty.";
return false;
@ -1263,6 +1263,14 @@ namespace WebSocketSharp {
return false;
}
}
else
{
port = scheme == "ws"
? 80
: 443;
var url = String.Format("{0}://{1}:{2}{3}", scheme, uri.Host, port, uri.PathAndQuery);
uri = url.ToUri();
}
result = uri;
message = String.Empty;

View File

@ -65,18 +65,18 @@ namespace WebSocketSharp {
#region Private Fields
private string _base64key;
private bool _client;
private Action _closeContext;
private WebSocketContext _context;
private string _extensions;
private AutoResetEvent _exitMessageLoop;
private Object _forClose;
private Object _forSend;
private bool _isClient;
private bool _isSecure;
private string _protocol;
private string _protocols;
private volatile WsState _readyState;
private AutoResetEvent _receivePong;
private bool _secure;
private TcpClient _tcpClient;
private Uri _uri;
private WsStream _wsStream;
@ -119,10 +119,13 @@ namespace WebSocketSharp {
#region Public Constructors
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketSharp.WebSocket"/> class with the specified WebSocket URL and subprotocols.
/// Initializes a new instance of the <see cref="WebSocket"/> class with the specified WebSocket URL and subprotocols.
/// </summary>
/// <remarks>
///
/// </remarks>
/// <param name="url">
/// A <see cref="string"/> that contains the WebSocket URL.
/// A <see cref="string"/> that contains a WebSocket URL.
/// </param>
/// <param name="protocols">
/// An array of <see cref="string"/> that contains the WebSocket subprotocols if any.
@ -141,33 +144,40 @@ namespace WebSocketSharp {
Uri uri;
string msg;
if (!tryCreateUri(url, out uri, out msg))
if (!url.TryCreateWebSocketUri(out uri, out msg))
throw new ArgumentException(msg, "url");
_uri = uri;
_protocols = protocols.ToString(", ");
_base64key = createBase64Key();
_isClient = true;
_isSecure = uri.Scheme == "wss" ? true : false;
_client = true;
_secure = uri.Scheme == "wss"
? true
: false;
}
/// <summary>
/// Initializes a new instance of the <see cref="WebSocketSharp.WebSocket"/> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
/// Initializes a new instance of the <see cref="WebSocket"/> class with the specified WebSocket URL,
/// OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
/// </summary>
/// <remarks>
/// This constructor initializes a new instance of the <see cref="WebSocket"/> class and
/// establishes a WebSocket connection.
/// </remarks>
/// <param name="url">
/// A <see cref="string"/> that contains the WebSocket URL.
/// A <see cref="string"/> that contains a WebSocket URL.
/// </param>
/// <param name="onOpen">
/// An OnOpen event handler.
/// An <see cref="OnOpen"/> event handler.
/// </param>
/// <param name="onMessage">
/// An OnMessage event handler.
/// An <see cref="OnMessage"/> event handler.
/// </param>
/// <param name="onError">
/// An OnError event handler.
/// An <see cref="OnError"/> event handler.
/// </param>
/// <param name="onClose">
/// An OnClose event handler.
/// An <see cref="OnClose"/> event handler.
/// </param>
/// <param name="protocols">
/// An array of <see cref="string"/> that contains the WebSocket subprotocols if any.
@ -234,7 +244,7 @@ namespace WebSocketSharp {
/// </value>
public bool IsSecure {
get {
return _isSecure;
return _secure;
}
}
@ -274,7 +284,7 @@ namespace WebSocketSharp {
}
internal set {
if (_readyState == WsState.CONNECTING && !_isClient)
if (_readyState == WsState.CONNECTING && !_client)
_uri = value;
}
}
@ -284,17 +294,17 @@ namespace WebSocketSharp {
#region Events
/// <summary>
/// Occurs when the WebSocket receives a Close frame or the Close method is called.
/// Occurs when the <see cref="WebSocket"/> receives a Close frame or the Close method is called.
/// </summary>
public event EventHandler<CloseEventArgs> OnClose;
/// <summary>
/// Occurs when the WebSocket gets an error.
/// Occurs when the <see cref="WebSocket"/> gets an error.
/// </summary>
public event EventHandler<ErrorEventArgs> OnError;
/// <summary>
/// Occurs when the WebSocket receives a data frame.
/// Occurs when the <see cref="WebSocket"/> receives a data frame.
/// </summary>
public event EventHandler<MessageEventArgs> OnMessage;
@ -333,7 +343,7 @@ namespace WebSocketSharp {
private void close(HttpStatusCode code)
{
if (_readyState != WsState.CONNECTING || _isClient)
if (_readyState != WsState.CONNECTING || _client)
return;
sendResponseHandshake(code);
@ -353,7 +363,7 @@ namespace WebSocketSharp {
return;
// Whether the closing handshake as server is started before the connection has been established ?
if (_readyState == WsState.CONNECTING && !_isClient)
if (_readyState == WsState.CONNECTING && !_client)
{
sendResponseHandshake(HttpStatusCode.BadRequest);
onClose(new CloseEventArgs(data));
@ -418,7 +428,7 @@ namespace WebSocketSharp {
try
{
if (_isClient)
if (_client)
closeResourcesAsClient();
else
closeResourcesAsServer();
@ -461,7 +471,7 @@ namespace WebSocketSharp {
private bool connect()
{
return _isClient
return _client
? doHandshake()
: acceptHandshake();
}
@ -476,23 +486,9 @@ namespace WebSocketSharp {
return Convert.ToBase64String(src);
}
// As Client
private void createClientStream()
{
var host = _uri.DnsSafeHost;
var port = _uri.Port > 0
? _uri.Port
: _isSecure
? 443
: 80;
_tcpClient = new TcpClient(host, port);
_wsStream = WsStream.CreateClientStream(_tcpClient, host, _isSecure);
}
private WsFrame createFrame(Fin fin, Opcode opcode, PayloadData payloadData)
{
return _isClient
return _client
? new WsFrame(fin, opcode, payloadData)
: new WsFrame(fin, opcode, Mask.UNMASK, payloadData);
}
@ -501,10 +497,9 @@ namespace WebSocketSharp {
private RequestHandshake createOpeningHandshake()
{
var path = _uri.PathAndQuery;
var host = _uri.DnsSafeHost;
var port = ((System.Net.IPEndPoint)_tcpClient.Client.RemoteEndPoint).Port;
if (port != 80)
host += ":" + port;
var host = _uri.Port == 80
? _uri.DnsSafeHost
: _uri.Authority;
var req = new RequestHandshake(path);
req.AddHeader("Host", host);
@ -547,17 +542,17 @@ namespace WebSocketSharp {
// As Client
private bool doHandshake()
{
createClientStream();
return sendOpeningHandshake();
sendOpeningHandshake();
return receiveResponseHandshake();
}
// As Server
private void init(WebSocketContext context)
{
_context = context;
_uri = context.Path.ToUri();
_isSecure = context.IsSecureConnection;
_isClient = false;
_context = context;
_uri = context.Path.ToUri();
_secure = context.IsSecureConnection;
_client = false;
}
private bool isValidCloseStatusCode(ushort code, out string message)
@ -848,14 +843,28 @@ namespace WebSocketSharp {
}
// As Client
private ResponseHandshake receiveResponseHandshake()
private bool receiveResponseHandshake()
{
var res = ResponseHandshake.Parse(readHandshake());
#if DEBUG
Console.WriteLine("WS: Info@receiveResponseHandshake: Response handshake from server:\n");
Console.WriteLine(res.ToString());
#endif
return res;
if (!isValidResponse(res))
{
var msg = "Invalid response to the WebSocket connection request.";
onError(msg);
close(CloseStatusCode.ABNORMAL, msg);
return false;
}
if (res.HeaderExists("Sec-WebSocket-Protocol"))
_protocol = res.Headers["Sec-WebSocket-Protocol"];
if (res.HeaderExists("Sec-WebSocket-Extensions"))
_extensions = res.Headers["Sec-WebSocket-Extensions"];
return true;
}
private bool send(WsFrame frame)
@ -990,27 +999,11 @@ namespace WebSocketSharp {
}
// As Client
private bool sendOpeningHandshake()
private void sendOpeningHandshake()
{
setClientStream();
var req = createOpeningHandshake();
sendRequestHandshake(req);
var res = receiveResponseHandshake();
if (!isValidResponse(res))
{
var msg = "Invalid response to the WebSocket connection request.";
onError(msg);
close(CloseStatusCode.ABNORMAL, msg);
return false;
}
if (res.HeaderExists("Sec-WebSocket-Protocol"))
_protocol = res.Headers["Sec-WebSocket-Protocol"];
if (res.HeaderExists("Sec-WebSocket-Extensions"))
_extensions = res.Headers["Sec-WebSocket-Extensions"];
return true;
}
// As Client
@ -1047,6 +1040,15 @@ namespace WebSocketSharp {
writeHandshake(response);
}
// As Client
private void setClientStream()
{
var host = _uri.DnsSafeHost;
var port = _uri.Port;
_tcpClient = new TcpClient(host, port);
_wsStream = WsStream.CreateClientStream(_tcpClient, host, _secure);
}
private void startMessageLoop()
{
_exitMessageLoop = new AutoResetEvent(false);
@ -1076,11 +1078,6 @@ namespace WebSocketSharp {
_wsStream.ReadFrameAsync(completed);
}
private bool tryCreateUri(string uriString, out Uri result, out string message)
{
return uriString.TryCreateWebSocketUri(out result, out message);
}
private void writeHandshake(Handshake handshake)
{
_wsStream.WriteHandshake(handshake);
@ -1101,7 +1098,7 @@ namespace WebSocketSharp {
#region Public Methods
/// <summary>
/// Closes the connection and releases all associated resources after sends a Close control frame.
/// Closes the WebSocket connection and releases all associated resources.
/// </summary>
public void Close()
{
@ -1110,21 +1107,11 @@ namespace WebSocketSharp {
}
/// <summary>
/// Closes the connection and releases all associated resources after sends a Close control frame.
/// Closes the WebSocket connection with the specified <paramref name="code"/>
/// and releases all associated resources.
/// </summary>
/// <param name="code">
/// A <see cref="CloseStatusCode"/> that contains a status code indicating a reason for closure.
/// </param>
public void Close(CloseStatusCode code)
{
Close(code, String.Empty);
}
/// <summary>
/// Closes the connection and releases all associated resources after sends a Close control frame.
/// </summary>
/// <param name="code">
/// A <see cref="ushort"/> that contains a status code indicating a reason for closure.
/// A <see cref="ushort"/> that contains a status code indicating the reason for closure.
/// </param>
public void Close(ushort code)
{
@ -1132,27 +1119,27 @@ namespace WebSocketSharp {
}
/// <summary>
/// Closes the connection and releases all associated resources after sends a Close control frame.
/// Closes the WebSocket connection with the specified <paramref name="code"/>
/// and releases all associated resources.
/// </summary>
/// <param name="code">
/// A <see cref="CloseStatusCode"/> that contains a status code indicating a reason for closure.
/// One of the <see cref="CloseStatusCode"/> values that contains a status code
/// indicating the reason for closure.
/// </param>
/// <param name="reason">
/// A <see cref="string"/> that contains a reason for closure.
/// </param>
public void Close(CloseStatusCode code, string reason)
public void Close(CloseStatusCode code)
{
Close((ushort)code, reason);
Close(code, String.Empty);
}
/// <summary>
/// Closes the connection and releases all associated resources after sends a Close control frame.
/// Closes the WebSocket connection with the specified <paramref name="code"/> and <paramref name="reason"/>,
/// and releases all associated resources.
/// </summary>
/// <param name="code">
/// A <see cref="ushort"/> that contains a status code indicating a reason for closure.
/// A <see cref="ushort"/> that contains a status code indicating the reason for closure.
/// </param>
/// <param name="reason">
/// A <see cref="string"/> that contains a reason for closure.
/// A <see cref="string"/> that contains the reason for closure.
/// </param>
public void Close(ushort code, string reason)
{
@ -1166,6 +1153,22 @@ namespace WebSocketSharp {
close(code, reason);
}
/// <summary>
/// Closes the WebSocket connection with the specified <paramref name="code"/> and <paramref name="reason"/>,
/// and releases all associated resources.
/// </summary>
/// <param name="code">
/// One of the <see cref="CloseStatusCode"/> values that contains a status code
/// indicating the reason for closure.
/// </param>
/// <param name="reason">
/// A <see cref="string"/> that contains the reason for closure.
/// </param>
public void Close(CloseStatusCode code, string reason)
{
Close((ushort)code, reason);
}
/// <summary>
/// Establishes a WebSocket connection.
/// </summary>
@ -1191,13 +1194,10 @@ namespace WebSocketSharp {
}
/// <summary>
/// Closes the connection and releases all associated resources after sends a Close control frame.
/// Closes the WebSocket connection and releases all associated resources.
/// </summary>
/// <remarks>
/// Call <see cref="Dispose"/> when you are finished using the <see cref="WebSocketSharp.WebSocket"/>. The
/// <see cref="Dispose"/> method leaves the <see cref="WebSocketSharp.WebSocket"/> in an unusable state. After
/// calling <see cref="Dispose"/>, you must release all references to the <see cref="WebSocketSharp.WebSocket"/> so
/// the garbage collector can reclaim the memory that the <see cref="WebSocketSharp.WebSocket"/> was occupying.
/// This method closes the WebSocket connection with the <see cref="CloseStatusCode.AWAY"/>.
/// </remarks>
public void Dispose()
{
@ -1205,10 +1205,10 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a Ping frame using the connection.
/// Pings using the WebSocket connection.
/// </summary>
/// <returns>
/// <c>true</c> if the WebSocket receives a Pong frame in a time; otherwise, <c>false</c>.
/// <c>true</c> if the <see cref="WebSocket"/> receives a Pong in a time; otherwise, <c>false</c>.
/// </returns>
public bool Ping()
{
@ -1216,26 +1216,26 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a Ping frame with a message using the connection.
/// Pings with the specified <paramref name="message"/> using the WebSocket connection.
/// </summary>
/// <param name="message">
/// A <see cref="string"/> that contains the message to be sent.
/// A <see cref="string"/> that contains a message.
/// </param>
/// <returns>
/// <c>true</c> if the WebSocket receives a Pong frame in a time; otherwise, <c>false</c>.
/// <c>true</c> if the <see cref="WebSocket"/> receives a Pong in a time; otherwise, <c>false</c>.
/// </returns>
public bool Ping(string message)
{
if (message.IsNull())
message = String.Empty;
return _isClient
return _client
? ping(message, 5 * 1000)
: ping(message, 1 * 1000);
}
/// <summary>
/// Sends a binary data using the connection.
/// Sends a binary <paramref name="data"/> using the WebSocket connection.
/// </summary>
/// <param name="data">
/// An array of <see cref="byte"/> that contains a binary data to send.
@ -1252,7 +1252,7 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a text data using the connection.
/// Sends a text <paramref name="data"/> using the WebSocket connection.
/// </summary>
/// <param name="data">
/// A <see cref="string"/> that contains a text data to send.
@ -1270,7 +1270,7 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a binary data using the connection.
/// Sends a binary data using the WebSocket connection.
/// </summary>
/// <param name="file">
/// A <see cref="FileInfo"/> that contains a binary data to send.
@ -1290,13 +1290,14 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a binary data asynchronously using the connection.
/// Sends a binary <paramref name="data"/> asynchronously using the WebSocket connection.
/// </summary>
/// <param name="data">
/// An array of <see cref="byte"/> that contains a binary data to send.
/// </param>
/// <param name="completed">
/// An <see cref="Action"/> delegate that contains the method(s) that is called when an asynchronous operation completes.
/// An <see cref="Action"/> delegate that references the method(s) called when
/// the asynchronous operation completes.
/// </param>
public void SendAsync(byte[] data, Action completed)
{
@ -1310,13 +1311,14 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a text data asynchronously using the connection.
/// Sends a text <paramref name="data"/> asynchronously using the WebSocket connection.
/// </summary>
/// <param name="data">
/// A <see cref="string"/> that contains a text data to send.
/// </param>
/// <param name="completed">
/// An <see cref="Action"/> delegate that contains the method(s) that is called when an asynchronous operation completes.
/// An <see cref="Action"/> delegate that references the method(s) called when
/// the asynchronous operation completes.
/// </param>
public void SendAsync(string data, Action completed)
{
@ -1331,13 +1333,14 @@ namespace WebSocketSharp {
}
/// <summary>
/// Sends a binary data asynchronously using the connection.
/// Sends a binary data asynchronously using the WebSocket connection.
/// </summary>
/// <param name="file">
/// A <see cref="FileInfo"/> that contains a binary data to send.
/// </param>
/// <param name="completed">
/// An <see cref="Action"/> delegate that contains the method(s) that is called when an asynchronous operation completes.
/// An <see cref="Action"/> delegate that references the method(s) called when
/// the asynchronous operation completes.
/// </param>
public void SendAsync(FileInfo file, Action completed)
{

View File

@ -811,8 +811,10 @@
<summary>
Initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class with the specified WebSocket URL and subprotocols.
</summary>
<remarks>
</remarks>
<param name="url">
A <see cref="T:System.String" /> that contains the WebSocket URL.
A <see cref="T:System.String" /> that contains a WebSocket URL.
</param>
<param name="protocols">
An array of <see cref="T:System.String" /> that contains the WebSocket subprotocols if any.
@ -826,22 +828,27 @@
</member>
<member name="M:WebSocketSharp.WebSocket.#ctor(System.String,System.EventHandler,System.EventHandler{WebSocketSharp.MessageEventArgs},System.EventHandler{WebSocketSharp.ErrorEventArgs},System.EventHandler{WebSocketSharp.CloseEventArgs},System.String[])">
<summary>
Initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class with the specified WebSocket URL,
OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
</summary>
<remarks>
This constructor initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class and
establishes a WebSocket connection.
</remarks>
<param name="url">
A <see cref="T:System.String" /> that contains the WebSocket URL.
A <see cref="T:System.String" /> that contains a WebSocket URL.
</param>
<param name="onOpen">
An OnOpen event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnOpen" /> event handler.
</param>
<param name="onMessage">
An OnMessage event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnMessage" /> event handler.
</param>
<param name="onError">
An OnError event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnError" /> event handler.
</param>
<param name="onClose">
An OnClose event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnClose" /> event handler.
</param>
<param name="protocols">
An array of <see cref="T:System.String" /> that contains the WebSocket subprotocols if any.
@ -855,17 +862,17 @@
</member>
<member name="E:WebSocketSharp.WebSocket.OnClose">
<summary>
Occurs when the WebSocket receives a Close frame or the Close method is called.
Occurs when the <see cref="T:WebSocketSharp.WebSocket" /> receives a Close frame or the Close method is called.
</summary>
</member>
<member name="E:WebSocketSharp.WebSocket.OnError">
<summary>
Occurs when the WebSocket gets an error.
Occurs when the <see cref="T:WebSocketSharp.WebSocket" /> gets an error.
</summary>
</member>
<member name="E:WebSocketSharp.WebSocket.OnMessage">
<summary>
Occurs when the WebSocket receives a data frame.
Occurs when the <see cref="T:WebSocketSharp.WebSocket" /> receives a data frame.
</summary>
</member>
<member name="E:WebSocketSharp.WebSocket.OnOpen">
@ -923,45 +930,51 @@
</member>
<member name="M:WebSocketSharp.WebSocket.Close">
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</summary>
</member>
<member name="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode)">
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
</summary>
<param name="code">
A <see cref="T:WebSocketSharp.CloseStatusCode" /> that contains a status code indicating a reason for closure.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.Close(System.UInt16)">
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" />
and releases all associated resources.
</summary>
<param name="code">
A <see cref="T:System.UInt16" /> that contains a status code indicating a reason for closure.
A <see cref="T:System.UInt16" /> that contains a status code indicating the reason for closure.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode,System.String)">
<member name="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode)">
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" />
and releases all associated resources.
</summary>
<param name="code">
A <see cref="T:WebSocketSharp.CloseStatusCode" /> that contains a status code indicating a reason for closure.
</param>
<param name="reason">
A <see cref="T:System.String" /> that contains a reason for closure.
One of the <see cref="T:WebSocketSharp.CloseStatusCode" /> values that contains a status code
indicating the reason for closure.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.Close(System.UInt16,System.String)">
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" /> and <paramref name="reason" />,
and releases all associated resources.
</summary>
<param name="code">
A <see cref="T:System.UInt16" /> that contains a status code indicating a reason for closure.
A <see cref="T:System.UInt16" /> that contains a status code indicating the reason for closure.
</param>
<param name="reason">
A <see cref="T:System.String" /> that contains a reason for closure.
A <see cref="T:System.String" /> that contains the reason for closure.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode,System.String)">
<summary>
Closes the WebSocket connection with the specified <paramref name="code" /> and <paramref name="reason" />,
and releases all associated resources.
</summary>
<param name="code">
One of the <see cref="T:WebSocketSharp.CloseStatusCode" /> values that contains a status code
indicating the reason for closure.
</param>
<param name="reason">
A <see cref="T:System.String" /> that contains the reason for closure.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.Connect">
@ -971,37 +984,34 @@
</member>
<member name="M:WebSocketSharp.WebSocket.Dispose">
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</summary>
<remarks>
Call <see cref="M:WebSocketSharp.WebSocket.Dispose" /> when you are finished using the <see cref="T:WebSocketSharp.WebSocket" />. The
<see cref="M:WebSocketSharp.WebSocket.Dispose" /> method leaves the <see cref="T:WebSocketSharp.WebSocket" /> in an unusable state. After
calling <see cref="M:WebSocketSharp.WebSocket.Dispose" />, you must release all references to the <see cref="T:WebSocketSharp.WebSocket" /> so
the garbage collector can reclaim the memory that the <see cref="T:WebSocketSharp.WebSocket" /> was occupying.
This method closes the WebSocket connection with the <see cref="F:WebSocketSharp.CloseStatusCode.AWAY" />.
</remarks>
</member>
<member name="M:WebSocketSharp.WebSocket.Ping">
<summary>
Sends a Ping frame using the connection.
Pings using the WebSocket connection.
</summary>
<returns>
<c>true</c> if the WebSocket receives a Pong frame in a time; otherwise, <c>false</c>.
<c>true</c> if the <see cref="T:WebSocketSharp.WebSocket" /> receives a Pong in a time; otherwise, <c>false</c>.
</returns>
</member>
<member name="M:WebSocketSharp.WebSocket.Ping(System.String)">
<summary>
Sends a Ping frame with a message using the connection.
Pings with the specified <paramref name="message" /> using the WebSocket connection.
</summary>
<param name="message">
A <see cref="T:System.String" /> that contains the message to be sent.
A <see cref="T:System.String" /> that contains a message.
</param>
<returns>
<c>true</c> if the WebSocket receives a Pong frame in a time; otherwise, <c>false</c>.
<c>true</c> if the <see cref="T:WebSocketSharp.WebSocket" /> receives a Pong in a time; otherwise, <c>false</c>.
</returns>
</member>
<member name="M:WebSocketSharp.WebSocket.Send(System.Byte[])">
<summary>
Sends a binary data using the connection.
Sends a binary <paramref name="data" /> using the WebSocket connection.
</summary>
<param name="data">
An array of <see cref="T:System.Byte" /> that contains a binary data to send.
@ -1009,7 +1019,7 @@
</member>
<member name="M:WebSocketSharp.WebSocket.Send(System.String)">
<summary>
Sends a text data using the connection.
Sends a text <paramref name="data" /> using the WebSocket connection.
</summary>
<param name="data">
A <see cref="T:System.String" /> that contains a text data to send.
@ -1017,7 +1027,7 @@
</member>
<member name="M:WebSocketSharp.WebSocket.Send(System.IO.FileInfo)">
<summary>
Sends a binary data using the connection.
Sends a binary data using the WebSocket connection.
</summary>
<param name="file">
A <see cref="T:System.IO.FileInfo" /> that contains a binary data to send.
@ -1025,35 +1035,38 @@
</member>
<member name="M:WebSocketSharp.WebSocket.SendAsync(System.Byte[],System.Action)">
<summary>
Sends a binary data asynchronously using the connection.
Sends a binary <paramref name="data" /> asynchronously using the WebSocket connection.
</summary>
<param name="data">
An array of <see cref="T:System.Byte" /> that contains a binary data to send.
</param>
<param name="completed">
An <see cref="T:System.Action" /> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <see cref="T:System.Action" /> delegate that references the method(s) called when
the asynchronous operation completes.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.SendAsync(System.String,System.Action)">
<summary>
Sends a text data asynchronously using the connection.
Sends a text <paramref name="data" /> asynchronously using the WebSocket connection.
</summary>
<param name="data">
A <see cref="T:System.String" /> that contains a text data to send.
</param>
<param name="completed">
An <see cref="T:System.Action" /> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <see cref="T:System.Action" /> delegate that references the method(s) called when
the asynchronous operation completes.
</param>
</member>
<member name="M:WebSocketSharp.WebSocket.SendAsync(System.IO.FileInfo,System.Action)">
<summary>
Sends a binary data asynchronously using the connection.
Sends a binary data asynchronously using the WebSocket connection.
</summary>
<param name="file">
A <see cref="T:System.IO.FileInfo" /> that contains a binary data to send.
</param>
<param name="completed">
An <see cref="T:System.Action" /> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <see cref="T:System.Action" /> delegate that references the method(s) called when
the asynchronous operation completes.
</param>
</member>
<member name="T:WebSocketSharp.Server.WebSocketServer">

View File

@ -258,7 +258,8 @@
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler">EventHandler</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;MessageEventArgs&gt;</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;ErrorEventArgs&gt;</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;CloseEventArgs&gt;</a>, <b>params</b> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>[])</div>
</td>
<td>
Initializes a new instance of the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Initializes a new instance of the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> class with the specified WebSocket URL,
OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
</td>
</tr>
</table>
@ -368,7 +369,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Close">Close</a>
</b>()<blockquote>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</blockquote></td>
</tr>
<tr valign="top">
@ -380,7 +381,8 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Close(System.UInt16)">Close</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a>)<blockquote>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i>
and releases all associated resources.
</blockquote></td>
</tr>
<tr valign="top">
@ -392,7 +394,8 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode)">Close</a>
</b>(<a href="../WebSocketSharp/CloseStatusCode.html">CloseStatusCode</a>)<blockquote>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i>
and releases all associated resources.
</blockquote></td>
</tr>
<tr valign="top">
@ -404,7 +407,8 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Close(System.UInt16,System.String)">Close</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<blockquote>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i> and <i>reason</i>,
and releases all associated resources.
</blockquote></td>
</tr>
<tr valign="top">
@ -416,7 +420,8 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode,System.String)">Close</a>
</b>(<a href="../WebSocketSharp/CloseStatusCode.html">CloseStatusCode</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<blockquote>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i> and <i>reason</i>,
and releases all associated resources.
</blockquote></td>
</tr>
<tr valign="top">
@ -440,7 +445,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Dispose">Dispose</a>
</b>()<blockquote>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</blockquote></td>
</tr>
<tr valign="top">
@ -452,7 +457,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Ping">Ping</a>
</b>()<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
Sends a Ping frame using the connection.
Pings using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -464,7 +469,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Ping(System.String)">Ping</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote>
Sends a Ping frame with a message using the connection.
Pings with the specified <i>message</i> using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -476,7 +481,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Send(System.Byte[])">Send</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[])<blockquote>
Sends a binary data using the connection.
Sends a binary <i>data</i> using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -488,7 +493,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Send(System.IO.FileInfo)">Send</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.FileInfo">System.IO.FileInfo</a>)<blockquote>
Sends a binary data using the connection.
Sends a binary data using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -500,7 +505,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.Send(System.String)">Send</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>)<blockquote>
Sends a text data using the connection.
Sends a text <i>data</i> using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -512,7 +517,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.SendAsync(System.Byte[],System.Action)">SendAsync</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[], <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a>)<blockquote>
Sends a binary data asynchronously using the connection.
Sends a binary <i>data</i> asynchronously using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -524,7 +529,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.SendAsync(System.IO.FileInfo,System.Action)">SendAsync</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.FileInfo">System.IO.FileInfo</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a>)<blockquote>
Sends a binary data asynchronously using the connection.
Sends a binary data asynchronously using the WebSocket connection.
</blockquote></td>
</tr>
<tr valign="top">
@ -536,7 +541,7 @@
<b>
<a href="#M:WebSocketSharp.WebSocket.SendAsync(System.String,System.Action)">SendAsync</a>
</b>(<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a>)<blockquote>
Sends a text data asynchronously using the connection.
Sends a text <i>data</i> asynchronously using the WebSocket connection.
</blockquote></td>
</tr>
</table>
@ -557,7 +562,7 @@
</b>
</td>
<td>
Occurs when the WebSocket receives a Close frame or the Close method is called.
Occurs when the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> receives a Close frame or the Close method is called.
</td>
</tr>
<tr valign="top">
@ -571,7 +576,7 @@
</b>
</td>
<td>
Occurs when the WebSocket gets an error.
Occurs when the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> gets an error.
</td>
</tr>
<tr valign="top">
@ -585,7 +590,7 @@
</b>
</td>
<td>
Occurs when the WebSocket receives a data frame.
Occurs when the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> receives a data frame.
</td>
</tr>
<tr valign="top">
@ -654,7 +659,7 @@
<i>url</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains the WebSocket URL.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains a WebSocket URL.
</dd>
<dt>
<i>protocols</i>
@ -691,7 +696,6 @@
</blockquote>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="C:WebSocketSharp.WebSocket(System.String,System.String[]):Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="C:WebSocketSharp.WebSocket(System.String,System.String[]):Version Information">
@ -701,7 +705,8 @@
<h3 id="C:WebSocketSharp.WebSocket(System.String,System.EventHandler,System.EventHandler{WebSocketSharp.MessageEventArgs},System.EventHandler{WebSocketSharp.ErrorEventArgs},System.EventHandler{WebSocketSharp.CloseEventArgs},System.String[])">WebSocket Constructor</h3>
<blockquote id="C:WebSocketSharp.WebSocket(System.String,System.EventHandler,System.EventHandler{WebSocketSharp.MessageEventArgs},System.EventHandler{WebSocketSharp.ErrorEventArgs},System.EventHandler{WebSocketSharp.CloseEventArgs},System.String[]):member">
<p class="Summary">
Initializes a new instance of the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Initializes a new instance of the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> class with the specified WebSocket URL,
OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>WebSocket</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> url, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler">EventHandler</a> onOpen, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;MessageEventArgs&gt;</a> onMessage, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;ErrorEventArgs&gt;</a> onError, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;CloseEventArgs&gt;</a> onClose, <b>params</b> <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a>[] protocols)</div>
@ -712,31 +717,31 @@
<i>url</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains the WebSocket URL.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains a WebSocket URL.
</dd>
<dt>
<i>onOpen</i>
</dt>
<dd>
An OnOpen event handler.
An <a href="../WebSocketSharp/WebSocket.html#E:WebSocketSharp.WebSocket.OnOpen">WebSocket.OnOpen</a> event handler.
</dd>
<dt>
<i>onMessage</i>
</dt>
<dd>
An OnMessage event handler.
An <a href="../WebSocketSharp/WebSocket.html#E:WebSocketSharp.WebSocket.OnMessage">WebSocket.OnMessage</a> event handler.
</dd>
<dt>
<i>onError</i>
</dt>
<dd>
An OnError event handler.
An <a href="../WebSocketSharp/WebSocket.html#E:WebSocketSharp.WebSocket.OnError">WebSocket.OnError</a> event handler.
</dd>
<dt>
<i>onClose</i>
</dt>
<dd>
An OnClose event handler.
An <a href="../WebSocketSharp/WebSocket.html#E:WebSocketSharp.WebSocket.OnClose">WebSocket.OnClose</a> event handler.
</dd>
<dt>
<i>protocols</i>
@ -773,8 +778,9 @@
</blockquote>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="C:WebSocketSharp.WebSocket(System.String,System.EventHandler,System.EventHandler{WebSocketSharp.MessageEventArgs},System.EventHandler{WebSocketSharp.ErrorEventArgs},System.EventHandler{WebSocketSharp.CloseEventArgs},System.String[]):Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
This constructor initializes a new instance of the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> class and
establishes a WebSocket connection.
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="C:WebSocketSharp.WebSocket(System.String,System.EventHandler,System.EventHandler{WebSocketSharp.MessageEventArgs},System.EventHandler{WebSocketSharp.ErrorEventArgs},System.EventHandler{WebSocketSharp.CloseEventArgs},System.String[]):Version Information">
<b>Namespace: </b>WebSocketSharp<br /><b>Assembly: </b>websocket-sharp (in websocket-sharp.dll)</div>
@ -783,7 +789,7 @@
<h3 id="M:WebSocketSharp.WebSocket.Close">Close Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Close:member">
<p class="Summary">
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Close</b> ()</div>
@ -799,7 +805,8 @@
<h3 id="M:WebSocketSharp.WebSocket.Close(System.UInt16)">Close Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Close(System.UInt16):member">
<p class="Summary">
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i>
and releases all associated resources.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Close</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a> code)</div>
@ -810,7 +817,7 @@
<i>code</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a> that contains a status code indicating a reason for closure.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a> that contains a status code indicating the reason for closure.
</dd>
</dl>
</blockquote>
@ -826,7 +833,8 @@
<h3 id="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode)">Close Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode):member">
<p class="Summary">
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i>
and releases all associated resources.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Close</b> (<a href="../WebSocketSharp/CloseStatusCode.html">CloseStatusCode</a> code)</div>
@ -837,7 +845,8 @@
<i>code</i>
</dt>
<dd>
A <a href="../WebSocketSharp/CloseStatusCode.html">WebSocketSharp.CloseStatusCode</a> that contains a status code indicating a reason for closure.
One of the <a href="../WebSocketSharp/CloseStatusCode.html">WebSocketSharp.CloseStatusCode</a> values that contains a status code
indicating the reason for closure.
</dd>
</dl>
</blockquote>
@ -853,7 +862,8 @@
<h3 id="M:WebSocketSharp.WebSocket.Close(System.UInt16,System.String)">Close Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Close(System.UInt16,System.String):member">
<p class="Summary">
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i> and <i>reason</i>,
and releases all associated resources.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Close</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a> code, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> reason)</div>
@ -864,13 +874,13 @@
<i>code</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a> that contains a status code indicating a reason for closure.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.UInt16">ushort</a> that contains a status code indicating the reason for closure.
</dd>
<dt>
<i>reason</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains a reason for closure.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains the reason for closure.
</dd>
</dl>
</blockquote>
@ -886,7 +896,8 @@
<h3 id="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode,System.String)">Close Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Close(WebSocketSharp.CloseStatusCode,System.String):member">
<p class="Summary">
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <i>code</i> and <i>reason</i>,
and releases all associated resources.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Close</b> (<a href="../WebSocketSharp/CloseStatusCode.html">CloseStatusCode</a> code, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> reason)</div>
@ -897,13 +908,14 @@
<i>code</i>
</dt>
<dd>
A <a href="../WebSocketSharp/CloseStatusCode.html">WebSocketSharp.CloseStatusCode</a> that contains a status code indicating a reason for closure.
One of the <a href="../WebSocketSharp/CloseStatusCode.html">WebSocketSharp.CloseStatusCode</a> values that contains a status code
indicating the reason for closure.
</dd>
<dt>
<i>reason</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains a reason for closure.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains the reason for closure.
</dd>
</dl>
</blockquote>
@ -935,16 +947,13 @@
<h3 id="M:WebSocketSharp.WebSocket.Dispose">Dispose Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Dispose:member">
<p class="Summary">
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Dispose</b> ()</div>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="M:WebSocketSharp.WebSocket.Dispose:Remarks">
Call <a href="../WebSocketSharp/WebSocket.html#M:WebSocketSharp.WebSocket.Dispose">WebSocket.Dispose</a> when you are finished using the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a>. The
<a href="../WebSocketSharp/WebSocket.html#M:WebSocketSharp.WebSocket.Dispose">WebSocket.Dispose</a> method leaves the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> in an unusable state. After
calling <a href="../WebSocketSharp/WebSocket.html#M:WebSocketSharp.WebSocket.Dispose">WebSocket.Dispose</a>, you must release all references to the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> so
the garbage collector can reclaim the memory that the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> was occupying.
This method closes the WebSocket connection with the <a href="../WebSocketSharp/CloseStatusCode.html#F:WebSocketSharp.CloseStatusCode.AWAY">CloseStatusCode.AWAY</a>.
</div>
<h2 class="Section">Requirements</h2>
<div class="SectionBox" id="M:WebSocketSharp.WebSocket.Dispose:Version Information">
@ -1014,7 +1023,7 @@
<h3 id="E:WebSocketSharp.WebSocket.OnClose">OnClose Event</h3>
<blockquote id="E:WebSocketSharp.WebSocket.OnClose:member">
<p class="Summary">
Occurs when the WebSocket receives a Close frame or the Close method is called.
Occurs when the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> receives a Close frame or the Close method is called.
</p>
<h2>Syntax</h2>
<div class="Signature">public event <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;CloseEventArgs&gt;</a> <b>OnClose</b> </div>
@ -1030,7 +1039,7 @@
<h3 id="E:WebSocketSharp.WebSocket.OnError">OnError Event</h3>
<blockquote id="E:WebSocketSharp.WebSocket.OnError:member">
<p class="Summary">
Occurs when the WebSocket gets an error.
Occurs when the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> gets an error.
</p>
<h2>Syntax</h2>
<div class="Signature">public event <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;ErrorEventArgs&gt;</a> <b>OnError</b> </div>
@ -1046,7 +1055,7 @@
<h3 id="E:WebSocketSharp.WebSocket.OnMessage">OnMessage Event</h3>
<blockquote id="E:WebSocketSharp.WebSocket.OnMessage:member">
<p class="Summary">
Occurs when the WebSocket receives a data frame.
Occurs when the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> receives a data frame.
</p>
<h2>Syntax</h2>
<div class="Signature">public event <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventHandler`1">EventHandler&lt;MessageEventArgs&gt;</a> <b>OnMessage</b> </div>
@ -1078,13 +1087,13 @@
<h3 id="M:WebSocketSharp.WebSocket.Ping">Ping Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Ping:member">
<p class="Summary">
Sends a Ping frame using the connection.
Pings using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> <b>Ping</b> ()</div>
<h4 class="Subsection">Returns</h4>
<blockquote class="SubsectionBox" id="M:WebSocketSharp.WebSocket.Ping:Returns">
<tt>true</tt> if the WebSocket receives a Pong frame in a time; otherwise, <tt>false</tt>.
<tt>true</tt> if the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> receives a Pong in a time; otherwise, <tt>false</tt>.
</blockquote>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="M:WebSocketSharp.WebSocket.Ping:Remarks">
@ -1098,7 +1107,7 @@
<h3 id="M:WebSocketSharp.WebSocket.Ping(System.String)">Ping Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Ping(System.String):member">
<p class="Summary">
Sends a Ping frame with a message using the connection.
Pings with the specified <i>message</i> using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> <b>Ping</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> message)</div>
@ -1109,13 +1118,13 @@
<i>message</i>
</dt>
<dd>
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains the message to be sent.
A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> that contains a message.
</dd>
</dl>
</blockquote>
<h4 class="Subsection">Returns</h4>
<blockquote class="SubsectionBox" id="M:WebSocketSharp.WebSocket.Ping(System.String):Returns">
<tt>true</tt> if the WebSocket receives a Pong frame in a time; otherwise, <tt>false</tt>.
<tt>true</tt> if the <a href="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> receives a Pong in a time; otherwise, <tt>false</tt>.
</blockquote>
<h2 class="Section">Remarks</h2>
<div class="SectionBox" id="M:WebSocketSharp.WebSocket.Ping(System.String):Remarks">
@ -1169,7 +1178,7 @@
<h3 id="M:WebSocketSharp.WebSocket.Send(System.Byte[])">Send Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Send(System.Byte[]):member">
<p class="Summary">
Sends a binary data using the connection.
Sends a binary <i>data</i> using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Send</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[] data)</div>
@ -1196,7 +1205,7 @@
<h3 id="M:WebSocketSharp.WebSocket.Send(System.IO.FileInfo)">Send Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Send(System.IO.FileInfo):member">
<p class="Summary">
Sends a binary data using the connection.
Sends a binary data using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Send</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.FileInfo">System.IO.FileInfo</a> file)</div>
@ -1223,7 +1232,7 @@
<h3 id="M:WebSocketSharp.WebSocket.Send(System.String)">Send Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.Send(System.String):member">
<p class="Summary">
Sends a text data using the connection.
Sends a text <i>data</i> using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Send</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> data)</div>
@ -1250,7 +1259,7 @@
<h3 id="M:WebSocketSharp.WebSocket.SendAsync(System.Byte[],System.Action)">SendAsync Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.SendAsync(System.Byte[],System.Action):member">
<p class="Summary">
Sends a binary data asynchronously using the connection.
Sends a binary <i>data</i> asynchronously using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>SendAsync</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Byte">byte</a>[] data, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> completed)</div>
@ -1267,7 +1276,8 @@
<i>completed</i>
</dt>
<dd>
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that references the method(s) called when
the asynchronous operation completes.
</dd>
</dl>
</blockquote>
@ -1283,7 +1293,7 @@
<h3 id="M:WebSocketSharp.WebSocket.SendAsync(System.IO.FileInfo,System.Action)">SendAsync Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.SendAsync(System.IO.FileInfo,System.Action):member">
<p class="Summary">
Sends a binary data asynchronously using the connection.
Sends a binary data asynchronously using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>SendAsync</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IO.FileInfo">System.IO.FileInfo</a> file, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> completed)</div>
@ -1300,7 +1310,8 @@
<i>completed</i>
</dt>
<dd>
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that references the method(s) called when
the asynchronous operation completes.
</dd>
</dl>
</blockquote>
@ -1316,7 +1327,7 @@
<h3 id="M:WebSocketSharp.WebSocket.SendAsync(System.String,System.Action)">SendAsync Method</h3>
<blockquote id="M:WebSocketSharp.WebSocket.SendAsync(System.String,System.Action):member">
<p class="Summary">
Sends a text data asynchronously using the connection.
Sends a text <i>data</i> asynchronously using the WebSocket connection.
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>SendAsync</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.String">string</a> data, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> completed)</div>
@ -1333,7 +1344,8 @@
<i>completed</i>
</dt>
<dd>
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that references the method(s) called when
the asynchronous operation completes.
</dd>
</dl>
</blockquote>

View File

@ -37,7 +37,7 @@
</Parameters>
<Docs>
<param name="url">
A <see cref="T:System.String" /> that contains the WebSocket URL.
A <see cref="T:System.String" /> that contains a WebSocket URL.
</param>
<param name="protocols">
An array of <see cref="T:System.String" /> that contains the WebSocket subprotocols if any.
@ -45,7 +45,7 @@
<summary>
Initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class with the specified WebSocket URL and subprotocols.
</summary>
<remarks>To be added.</remarks>
<remarks />
<exception cref="T:System.ArgumentNullException">
<paramref name="url" /> is <see langword="null" />.
</exception>
@ -74,27 +74,31 @@
</Parameters>
<Docs>
<param name="url">
A <see cref="T:System.String" /> that contains the WebSocket URL.
A <see cref="T:System.String" /> that contains a WebSocket URL.
</param>
<param name="onOpen">
An OnOpen event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnOpen" /> event handler.
</param>
<param name="onMessage">
An OnMessage event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnMessage" /> event handler.
</param>
<param name="onError">
An OnError event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnError" /> event handler.
</param>
<param name="onClose">
An OnClose event handler.
An <see cref="E:WebSocketSharp.WebSocket.OnClose" /> event handler.
</param>
<param name="protocols">
An array of <see cref="T:System.String" /> that contains the WebSocket subprotocols if any.
</param>
<summary>
Initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class with the specified WebSocket URL,
OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
</summary>
<remarks>To be added.</remarks>
<remarks>
This constructor initializes a new instance of the <see cref="T:WebSocketSharp.WebSocket" /> class and
establishes a WebSocket connection.
</remarks>
<exception cref="T:System.ArgumentNullException">
<paramref name="url" /> is <see langword="null" />.
</exception>
@ -113,7 +117,7 @@
<Parameters />
<Docs>
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -130,10 +134,11 @@
</Parameters>
<Docs>
<param name="code">
A <see cref="T:System.UInt16" /> that contains a status code indicating a reason for closure.
A <see cref="T:System.UInt16" /> that contains a status code indicating the reason for closure.
</param>
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" />
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -150,10 +155,12 @@
</Parameters>
<Docs>
<param name="code">
A <see cref="T:WebSocketSharp.CloseStatusCode" /> that contains a status code indicating a reason for closure.
One of the <see cref="T:WebSocketSharp.CloseStatusCode" /> values that contains a status code
indicating the reason for closure.
</param>
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" />
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -171,13 +178,14 @@
</Parameters>
<Docs>
<param name="code">
A <see cref="T:System.UInt16" /> that contains a status code indicating a reason for closure.
A <see cref="T:System.UInt16" /> that contains a status code indicating the reason for closure.
</param>
<param name="reason">
A <see cref="T:System.String" /> that contains a reason for closure.
A <see cref="T:System.String" /> that contains the reason for closure.
</param>
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" /> and <paramref name="reason" />,
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -195,13 +203,15 @@
</Parameters>
<Docs>
<param name="code">
A <see cref="T:WebSocketSharp.CloseStatusCode" /> that contains a status code indicating a reason for closure.
One of the <see cref="T:WebSocketSharp.CloseStatusCode" /> values that contains a status code
indicating the reason for closure.
</param>
<param name="reason">
A <see cref="T:System.String" /> that contains a reason for closure.
A <see cref="T:System.String" /> that contains the reason for closure.
</param>
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection with the specified <paramref name="code" /> and <paramref name="reason" />,
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -231,13 +241,10 @@
<Parameters />
<Docs>
<summary>
Closes the connection and releases all associated resources after sends a Close control frame.
Closes the WebSocket connection and releases all associated resources.
</summary>
<remarks>
Call <see cref="M:WebSocketSharp.WebSocket.Dispose" /> when you are finished using the <see cref="T:WebSocketSharp.WebSocket" />. The
<see cref="M:WebSocketSharp.WebSocket.Dispose" /> method leaves the <see cref="T:WebSocketSharp.WebSocket" /> in an unusable state. After
calling <see cref="M:WebSocketSharp.WebSocket.Dispose" />, you must release all references to the <see cref="T:WebSocketSharp.WebSocket" /> so
the garbage collector can reclaim the memory that the <see cref="T:WebSocketSharp.WebSocket" /> was occupying.
This method closes the WebSocket connection with the <see cref="F:WebSocketSharp.CloseStatusCode.AWAY" />.
</remarks>
</Docs>
</Member>
@ -301,7 +308,7 @@
</ReturnValue>
<Docs>
<summary>
Occurs when the WebSocket receives a Close frame or the Close method is called.
Occurs when the <see cref="T:WebSocketSharp.WebSocket" /> receives a Close frame or the Close method is called.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -315,7 +322,7 @@
</ReturnValue>
<Docs>
<summary>
Occurs when the WebSocket gets an error.
Occurs when the <see cref="T:WebSocketSharp.WebSocket" /> gets an error.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -329,7 +336,7 @@
</ReturnValue>
<Docs>
<summary>
Occurs when the WebSocket receives a data frame.
Occurs when the <see cref="T:WebSocketSharp.WebSocket" /> receives a data frame.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -358,10 +365,10 @@
<Parameters />
<Docs>
<summary>
Sends a Ping frame using the connection.
Pings using the WebSocket connection.
</summary>
<returns>
<c>true</c> if the WebSocket receives a Pong frame in a time; otherwise, <c>false</c>.
<c>true</c> if the <see cref="T:WebSocketSharp.WebSocket" /> receives a Pong in a time; otherwise, <c>false</c>.
</returns>
<remarks>To be added.</remarks>
</Docs>
@ -378,13 +385,13 @@
</Parameters>
<Docs>
<param name="message">
A <see cref="T:System.String" /> that contains the message to be sent.
A <see cref="T:System.String" /> that contains a message.
</param>
<summary>
Sends a Ping frame with a message using the connection.
Pings with the specified <paramref name="message" /> using the WebSocket connection.
</summary>
<returns>
<c>true</c> if the WebSocket receives a Pong frame in a time; otherwise, <c>false</c>.
<c>true</c> if the <see cref="T:WebSocketSharp.WebSocket" /> receives a Pong in a time; otherwise, <c>false</c>.
</returns>
<remarks>To be added.</remarks>
</Docs>
@ -438,7 +445,7 @@
An array of <see cref="T:System.Byte" /> that contains a binary data to send.
</param>
<summary>
Sends a binary data using the connection.
Sends a binary <paramref name="data" /> using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -458,7 +465,7 @@
A <see cref="T:System.IO.FileInfo" /> that contains a binary data to send.
</param>
<summary>
Sends a binary data using the connection.
Sends a binary data using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -478,7 +485,7 @@
A <see cref="T:System.String" /> that contains a text data to send.
</param>
<summary>
Sends a text data using the connection.
Sends a text <paramref name="data" /> using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -499,10 +506,11 @@
An array of <see cref="T:System.Byte" /> that contains a binary data to send.
</param>
<param name="completed">
An <see cref="T:System.Action" /> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <see cref="T:System.Action" /> delegate that references the method(s) called when
the asynchronous operation completes.
</param>
<summary>
Sends a binary data asynchronously using the connection.
Sends a binary <paramref name="data" /> asynchronously using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -523,10 +531,11 @@
A <see cref="T:System.IO.FileInfo" /> that contains a binary data to send.
</param>
<param name="completed">
An <see cref="T:System.Action" /> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <see cref="T:System.Action" /> delegate that references the method(s) called when
the asynchronous operation completes.
</param>
<summary>
Sends a binary data asynchronously using the connection.
Sends a binary data asynchronously using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -547,10 +556,11 @@
A <see cref="T:System.String" /> that contains a text data to send.
</param>
<param name="completed">
An <see cref="T:System.Action" /> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <see cref="T:System.Action" /> delegate that references the method(s) called when
the asynchronous operation completes.
</param>
<summary>
Sends a text data asynchronously using the connection.
Sends a text <paramref name="data" /> asynchronously using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>

View File

@ -1,6 +1,6 @@
<Overview>
<Assemblies>
<Assembly Name="websocket-sharp" Version="1.0.2.27191">
<Assembly Name="websocket-sharp" Version="1.0.2.29673">
<AssemblyPublicKey>[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 11 00 00 00 29 17 fb 89 fe c3 91 f7 2b cb 8b e2 61 d2 3f 05 93 6d 65 a8 9e 63 72 a6 f5 d5 2c f2 9d 20 fa 0b c0 70 6a f6 88 7e 8b 90 3f 39 f5 76 c8 48 e0 bb 7b b2 7b ed d3 10 a7 1a 0f 70 98 0f 7f f4 4b 53 09 d2 a5 ef 36 c3 56 b4 aa f0 91 72 63 25 07 89 e0 93 3e 3f 2e f2 b9 73 0e 12 15 5d 43 56 c3 f4 70 a5 89 fe f7 f6 ac 3e 77 c2 d8 d0 84 91 f4 0c d1 f3 8e dc c3 c3 b8 38 3d 0c bf 17 de 20 78 c1 ]</AssemblyPublicKey>
<Attributes>
<Attribute>

Binary file not shown.