Skip to content
This repository was archived by the owner on Jun 23, 2022. It is now read-only.

Conversation

@chaosinnovator
Copy link

Not 100% sure if this has exact parity with the server's API, but it builds and works.

Copy link
Member

@Bond-009 Bond-009 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the Uri changes?

Copy link
Member

@Bond-009 Bond-009 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do a quick overview of the diff if you do find+replace changes to prevent having to wait for review to find out about little unintended changes. ;)

{
/// <summary>
/// Provides api methods centered around an HttpClient
/// </summary>
public partial class ApiClient : BaseApiClient, IApiClient
{
public event EventHandler<GenericEventArgs<RemoteLogoutReason>> RemoteLoggedOut;
public event EventHandler<GenericEventArgs<AuthenticationResult>> Authenticated;
public event EventHandler<GenericEventArgs<AuthenticationResult>> OnAuthenticated;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did this get changed?

}

var dict = new QueryStringDictionary { };
var dict = new NameValueCollection { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var dict = new NameValueCollection { };
var dict = new NameValueCollection();

{
if (query == null)
{
throw new ArgumentNullException("query");
}

var dict = new QueryStringDictionary { };
var dict = new NameValueCollection{ };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var dict = new NameValueCollection{ };
var dict = new NameValueCollection();

{
if (query == null)
{
throw new ArgumentNullException("query");
}

var dict = new QueryStringDictionary { };
var dict = new NameValueCollection { };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var dict = new NameValueCollection { };
var dict = new NameValueCollection();

@@ -1173,7 +1109,7 @@ public Task SendMessageCommandAsync(string sessionId, MessageCommand command)

if (command.TimeoutMs.HasValue)
{
cmd.Arguments["Timeout"] = command.TimeoutMs.Value.ToString(CultureInfo.InvariantCulture);
cmd.Arguments["Timeout"] = command.TimeoutMs?.ToString(CultureInfo.InvariantCulture);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

catch (Exception ex)
{
_logger.ErrorException("Error receiving web socket message", ex);
_logger.LogError("Error receiving web socket message", ex);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_logger.LogError("Error receiving web socket message", ex);
_logger.LogError(ex, "Error receiving web socket message");

if (!Enum.TryParse(type.ToString(), true, out System.Net.WebSockets.WebSocketMessageType nativeType))
{
_logger.Warn("Unrecognized WebSocketMessageType: {0}", type.ToString());
_logger.LogWarning("Unrecognized WebSocketMessageType: {0}", type.ToString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_logger.LogWarning("Unrecognized WebSocketMessageType: {0}", type.ToString());
_logger.LogWarning("Unrecognized WebSocketMessageType: {0}", type);

if (!Enum.TryParse(_client.State.ToString(), true, out WebSocketState commonState))
{
_logger.Warn("Unrecognized WebSocketState: {0}", _client.State.ToString());
_logger.LogWarning("Unrecognized WebSocketState: {0}", _client.State.ToString());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_logger.LogWarning("Unrecognized WebSocketState: {0}", _client.State.ToString());
_logger.LogWarning("Unrecognized WebSocketState: {0}", _client.State);


_socket.Opened += (sender, args) => taskCompletionSource.TrySetResult(true);
_socket.Closed += _socket_Closed;
_socket.Closed += Socket_Closed;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_socket.Closed += Socket_Closed;
_socket.Closed += OnSocketClosed;

_socket = new WebSocket4Net.WebSocket(url.ToString());

_socket.MessageReceived += websocket_MessageReceived;
_socket.MessageReceived += Websocket_MessageReceived;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_socket.MessageReceived += Websocket_MessageReceived;
_socket.MessageReceived += OnWebsocketMessageReceived;

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants