Skip to content
This repository was archived by the owner on Jan 20, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
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
49 changes: 49 additions & 0 deletions .vscode/snippets.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Place your snippets for csharp here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
// "Print to console": {
// "prefix": "log",
// "body": [
// "console.log('$1');",
// "$2"
// ],
// "description": "Log output to console"
// }
{
"fact": {
"scope": "csharp",
"prefix": "fact",
"body": [
"[Fact]",
"public void $1()",
"{",
" // ARRANGE",
" $2",
" // ACT",
" ",
" // ASSERT",
" ",
"}",
],
"description": "XUNIT fact"
},
"afact": {
"scope": "csharp",
"prefix": "afact",
"body": [
"[Fact]",
"public async Task $1()",
"{",
" // ARRANGE",
" $2",
" // ACT",
" ",
" // ASSERT",
" ",
"}",
],
"description": "XUNIT fact"
}
}
325 changes: 103 additions & 222 deletions src/HassClient/Client/HassClient.cs

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions src/HassClient/Client/HassWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,30 @@ internal class HassWebSocket : IClientWebSocket

public WebSocketCloseStatus? CloseStatus => _ws.CloseStatus;

public async Task ConnectAsync(Uri uri, CancellationToken cancel) => await _ws.ConnectAsync(uri, cancel);
public Task ConnectAsync(Uri uri, CancellationToken cancel) => _ws.ConnectAsync(uri, cancel);

public async Task CloseAsync(WebSocketCloseStatus closeStatus, string statusDescription,
public Task CloseAsync(WebSocketCloseStatus closeStatus, string statusDescription,
CancellationToken cancellationToken) =>
await _ws.CloseAsync(closeStatus, statusDescription, cancellationToken);
_ws.CloseAsync(closeStatus, statusDescription, cancellationToken);

public async Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string statusDescription,
public Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string statusDescription,
CancellationToken cancellationToken) =>
await _ws.CloseAsync(closeStatus, statusDescription, cancellationToken);
_ws.CloseAsync(closeStatus, statusDescription, cancellationToken);

public async Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage,
public Task SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage,
CancellationToken cancellationToken) =>
await _ws.SendAsync(buffer, messageType, endOfMessage, cancellationToken);
_ws.SendAsync(buffer, messageType, endOfMessage, cancellationToken);

public async ValueTask SendAsync(ReadOnlyMemory<byte> buffer, WebSocketMessageType messageType,
bool endOfMessage, CancellationToken cancellationToken) =>
await Task.FromException(new NotImplementedException());

public async Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer,
public Task<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer,
CancellationToken cancellationToken) =>
await Task.FromException<WebSocketReceiveResult>(new NotImplementedException());
Task.FromException<WebSocketReceiveResult>(new NotImplementedException());

public async ValueTask<ValueWebSocketReceiveResult> ReceiveAsync(Memory<byte> buffer,
CancellationToken cancellationToken) => await _ws.ReceiveAsync(buffer, cancellationToken);
public ValueTask<ValueWebSocketReceiveResult> ReceiveAsync(Memory<byte> buffer,
CancellationToken cancellationToken) => _ws.ReceiveAsync(buffer, cancellationToken);

#region IDisposable Support

Expand Down
Loading