Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions WebSocket/WebSocketMono.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
namespace Unity3dAzure.WebSockets {
public class WebSocketMono : IWebSocket {
private WebSocket socket;

public event OnOpen OnOpen;
public event OnError OnError;
public event OnMessage OnMessage;
Expand All @@ -39,7 +39,7 @@ public void ConfigureWebSocket(string url, List<KeyValuePair<string, string>> he
socket = new WebSocket(url);

// add custom web socket headers
if (headers != null || headers.Count > 0) {
if (headers != null && headers.Count > 0) {
socket.CustomHeaders = headers;
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ public void SendAsync(string text, Action<bool> completed = null) {
socket.SendAsync(text, completed);
}

#region WebSocket Handlers
#region WebSocket Handlers

private void AttachHandlers() {
if (isAttached) {
Expand All @@ -111,7 +111,7 @@ private void UnattachHandlers() {
}

private void Dispose() {
((IDisposable)socket).Dispose();
((IDisposable) socket).Dispose();
socket = null;
isAttached = false;
}
Expand Down Expand Up @@ -143,7 +143,7 @@ private void HandleOnClose(object sender, WebSocketSharp.CloseEventArgs e) {
Dispose();
}

#endregion
#endregion

public bool CheckValidCertificateCallback(System.Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) {
bool valid = true;
Expand All @@ -156,7 +156,7 @@ public bool CheckValidCertificateCallback(System.Object sender, X509Certificate
chain.ChainPolicy.RevocationMode = X509RevocationMode.Online;
chain.ChainPolicy.UrlRetrievalTimeout = new TimeSpan(0, 1, 0);
chain.ChainPolicy.VerificationFlags = X509VerificationFlags.AllFlags;
bool chainIsValid = chain.Build((X509Certificate2)certificate);
bool chainIsValid = chain.Build((X509Certificate2) certificate);
if (!chainIsValid) {
valid = false;
}
Expand Down