/// 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 {
Uriuri;
stringmsg;
if(!tryCreateUri(url,outuri,outmsg))
if(!url.TryCreateWebSocketUri(outuri,outmsg))
thrownewArgumentException(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>
publicboolIsSecure{
get{
return_isSecure;
return_secure;
}
}
@ -274,7 +284,7 @@ namespace WebSocketSharp {
}
internalset{
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>
publiceventEventHandler<CloseEventArgs>OnClose;
/// <summary>
/// Occurs when the WebSocket gets an error.
/// Occurs when the <see cref="WebSocket"/> gets an error.
/// </summary>
publiceventEventHandler<ErrorEventArgs>OnError;
/// <summary>
/// Occurs when the WebSocket receives a data frame.
/// Occurs when the <see cref="WebSocket"/> receives a data frame.
Initializes a new instance of the <seecref="T:WebSocketSharp.WebSocket"/> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Initializes a new instance of the <seecref="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 <seecref="T:WebSocketSharp.WebSocket"/> class and
establishes a WebSocket connection.
</remarks>
<paramname="url">
A <seecref="T:System.String"/> that contains the WebSocket URL.
A <seecref="T:System.String"/> that contains a WebSocket URL.
</param>
<paramname="onOpen">
An OnOpen event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnOpen" /> event handler.
</param>
<paramname="onMessage">
An OnMessage event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnMessage" /> event handler.
</param>
<paramname="onError">
An OnError event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnError" /> event handler.
</param>
<paramname="onClose">
An OnClose event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnClose" /> event handler.
</param>
<paramname="protocols">
An array of <seecref="T:System.String"/> that contains the WebSocket subprotocols if any.
@ -855,17 +862,17 @@
</member>
<membername="E:WebSocketSharp.WebSocket.OnClose">
<summary>
Occurs when the WebSocket receives a Close frame or the Close method is called.
Occurs when the <seecref="T:WebSocketSharp.WebSocket" /> receives a Close frame or the Close method is called.
</summary>
</member>
<membername="E:WebSocketSharp.WebSocket.OnError">
<summary>
Occurs when the WebSocket gets an error.
Occurs when the <seecref="T:WebSocketSharp.WebSocket" /> gets an error.
Initializes a new instance of the <ahref="../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 <ahref="../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 <ahref="../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 <ahref="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> class with the specified WebSocket URL,
OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Call <ahref="../WebSocketSharp/WebSocket.html#M:WebSocketSharp.WebSocket.Dispose">WebSocket.Dispose</a> when you are finished using the <ahref="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a>. The
<ahref="../WebSocketSharp/WebSocket.html#M:WebSocketSharp.WebSocket.Dispose">WebSocket.Dispose</a> method leaves the <ahref="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> in an unusable state. After
calling <ahref="../WebSocketSharp/WebSocket.html#M:WebSocketSharp.WebSocket.Dispose">WebSocket.Dispose</a>, you must release all references to the <ahref="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> so
the garbage collector can reclaim the memory that the <ahref="../WebSocketSharp/WebSocket.html">WebSocketSharp.WebSocket</a> was occupying.
This method closes the WebSocket connection with the <ahref="../WebSocketSharp/CloseStatusCode.html#F:WebSocketSharp.CloseStatusCode.AWAY">CloseStatusCode.AWAY</a>.
An <ahref="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 <ahref="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that references the method(s) called when
An <ahref="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 <ahref="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that references the method(s) called when
An <ahref="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 <ahref="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Action">Action</a> delegate that references the method(s) called when
A <seecref="T:System.String"/> that contains the WebSocket URL.
A <seecref="T:System.String"/> that contains a WebSocket URL.
</param>
<paramname="protocols">
An array of <seecref="T:System.String"/> that contains the WebSocket subprotocols if any.
@ -45,7 +45,7 @@
<summary>
Initializes a new instance of the <seecref="T:WebSocketSharp.WebSocket"/> class with the specified WebSocket URL and subprotocols.
</summary>
<remarks>Tobe added.</remarks>
<remarks />
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="url"/> is <seelangword="null"/>.
</exception>
@ -74,27 +74,31 @@
</Parameters>
<Docs>
<paramname="url">
A <seecref="T:System.String"/> that contains the WebSocket URL.
A <seecref="T:System.String"/> that contains a WebSocket URL.
</param>
<paramname="onOpen">
An OnOpen event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnOpen" /> event handler.
</param>
<paramname="onMessage">
An OnMessage event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnMessage" /> event handler.
</param>
<paramname="onError">
An OnError event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnError" /> event handler.
</param>
<paramname="onClose">
An OnClose event handler.
An <seecref="E:WebSocketSharp.WebSocket.OnClose" /> event handler.
</param>
<paramname="protocols">
An array of <seecref="T:System.String"/> that contains the WebSocket subprotocols if any.
</param>
<summary>
Initializes a new instance of the <seecref="T:WebSocketSharp.WebSocket"/> class with the specified WebSocket URL, OnOpen, OnMessage, OnError, OnClose event handlers and subprotocols.
Initializes a new instance of the <seecref="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 <seecref="T:WebSocketSharp.WebSocket"/> class and
establishes a WebSocket connection.
</remarks>
<exceptioncref="T:System.ArgumentNullException">
<paramrefname="url"/> is <seelangword="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>
<paramname="code">
A <seecref="T:System.UInt16"/> that contains a status code indicating a reason for closure.
A <seecref="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 <paramrefname="code"/>
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -150,10 +155,12 @@
</Parameters>
<Docs>
<paramname="code">
A <seecref="T:WebSocketSharp.CloseStatusCode"/> that contains a status code indicating a reason for closure.
One of the <seecref="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 <paramrefname="code"/>
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -171,13 +178,14 @@
</Parameters>
<Docs>
<paramname="code">
A <seecref="T:System.UInt16"/> that contains a status code indicating a reason for closure.
A <seecref="T:System.UInt16"/> that contains a status code indicating the reason for closure.
</param>
<paramname="reason">
A <seecref="T:System.String"/> that contains a reason for closure.
A <seecref="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 <paramrefname="code"/> and <paramrefname="reason"/>,
and releases all associated resources.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -195,13 +203,15 @@
</Parameters>
<Docs>
<paramname="code">
A <seecref="T:WebSocketSharp.CloseStatusCode"/> that contains a status code indicating a reason for closure.
One of the <seecref="T:WebSocketSharp.CloseStatusCode"/> values that contains a status code
indicating the reason for closure.
</param>
<paramname="reason">
A <seecref="T:System.String"/> that contains a reason for closure.
A <seecref="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 <paramrefname="code"/> and <paramrefname="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 <seecref="M:WebSocketSharp.WebSocket.Dispose"/> when you are finished using the <seecref="T:WebSocketSharp.WebSocket"/>. The
<seecref="M:WebSocketSharp.WebSocket.Dispose"/> method leaves the <seecref="T:WebSocketSharp.WebSocket"/> in an unusable state. After
calling <seecref="M:WebSocketSharp.WebSocket.Dispose"/>, you must release all references to the <seecref="T:WebSocketSharp.WebSocket"/> so
the garbage collector can reclaim the memory that the <seecref="T:WebSocketSharp.WebSocket"/> was occupying.
This method closes the WebSocket connection with the <seecref="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 <seecref="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 <seecref="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 <seecref="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 <seecref="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>
<paramname="message">
A <seecref="T:System.String"/> that contains the message to be sent.
A <seecref="T:System.String"/> that contains a message.
</param>
<summary>
Sends a Ping frame with a message using the connection.
Pings with the specified <paramrefname="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 <seecref="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 <seecref="T:System.Byte"/> that contains a binary data to send.
</param>
<summary>
Sends a binary data using the connection.
Sends a binary <paramrefname="data" /> using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -458,7 +465,7 @@
A <seecref="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 <seecref="T:System.String"/> that contains a text data to send.
</param>
<summary>
Sends a text data using the connection.
Sends a text <paramrefname="data" /> using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -499,10 +506,11 @@
An array of <seecref="T:System.Byte"/> that contains a binary data to send.
</param>
<paramname="completed">
An <seecref="T:System.Action"/> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <seecref="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 <paramrefname="data" /> asynchronously using the WebSocket connection.
</summary>
<remarks>To be added.</remarks>
</Docs>
@ -523,10 +531,11 @@
A <seecref="T:System.IO.FileInfo"/> that contains a binary data to send.
</param>
<paramname="completed">
An <seecref="T:System.Action"/> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <seecref="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 <seecref="T:System.String"/> that contains a text data to send.
</param>
<paramname="completed">
An <seecref="T:System.Action"/> delegate that contains the method(s) that is called when an asynchronous operation completes.
An <seecref="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 <paramrefname="data" /> asynchronously using the WebSocket connection.