Slack.NetStandard.AsyncEnumerable 1.0.3

Additional support for Slack.NetStandard apps running Socket Mode

There is a newer version of this package available.
See the version list below for details.
Install-Package Slack.NetStandard.AsyncEnumerable -Version 1.0.3
dotnet add package Slack.NetStandard.AsyncEnumerable --version 1.0.3
<PackageReference Include="Slack.NetStandard.AsyncEnumerable" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Slack.NetStandard.AsyncEnumerable --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Slack.NetStandard.AsyncEnumerable, 1.0.3"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Slack.NetStandard.AsyncEnumerable as a Cake Addin
#addin nuget:?package=Slack.NetStandard.AsyncEnumerable&version=1.0.3

// Install Slack.NetStandard.AsyncEnumerable as a Cake Tool
#tool nuget:?package=Slack.NetStandard.AsyncEnumerable&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Slack.NetStandard.AsyncEnumerable

Additional support for Slack.NetStandard apps running Socket Mode

Creating a new client

var socketMode = new SocketModeClient(); //Can pass in your own ClientWebSocket instance
await socketMode.ConnectAsync(appToken); //Can use an existing SlackWebApiClient

Handling Envelopes

await foreach (var envelope in client.EnvelopeAsyncEnumerable(token))
{
    Console.WriteLine("processing envelope " + envelope.EnvelopeId);
    if (envelope.Payload is SlashCommand) //for example
    {
      //your logic here
    }
}

Hello and Disconnect

Hello and Disconnect messages are automatically handled by the SocketModeClient class.

Hello messages are sent "hello" in response

Disconnect closes the ClientWebSocket.
If there is a valid SlackWebApiClient, or the class was able to create one from an app token, then the class will attempt to retrieve a new connection URL and re-connect the ClientWebSocket automatically - allowing the foreach to continue without interruption.

If you require different functionality in these cases, there is an OnHello and OnDisconnect method which can be overwritten in a subclass

Sample Application

The Socket Sample app within Slack.NetStandard is a working example of a console application that uses this library, just supply your own app token

Slack.NetStandard.AsyncEnumerable

Additional support for Slack.NetStandard apps running Socket Mode

Creating a new client

var socketMode = new SocketModeClient(); //Can pass in your own ClientWebSocket instance
await socketMode.ConnectAsync(appToken); //Can use an existing SlackWebApiClient

Handling Envelopes

await foreach (var envelope in client.EnvelopeAsyncEnumerable(token))
{
    Console.WriteLine("processing envelope " + envelope.EnvelopeId);
    if (envelope.Payload is SlashCommand) //for example
    {
      //your logic here
    }
}

Hello and Disconnect

Hello and Disconnect messages are automatically handled by the SocketModeClient class.

Hello messages are sent "hello" in response

Disconnect closes the ClientWebSocket.
If there is a valid SlackWebApiClient, or the class was able to create one from an app token, then the class will attempt to retrieve a new connection URL and re-connect the ClientWebSocket automatically - allowing the foreach to continue without interruption.

If you require different functionality in these cases, there is an OnHello and OnDisconnect method which can be overwritten in a subclass

Sample Application

The Socket Sample app within Slack.NetStandard is a working example of a console application that uses this library, just supply your own app token

Release Notes

Fix StreamReader

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.2.0-beta1 49 4/7/2021
1.1.3 66 3/2/2021
1.1.2 170 2/24/2021
1.1.1 38 2/22/2021
1.0.3 72 1/30/2021
1.0.2 57 1/30/2021
1.0.1 64 1/30/2021
1.0.0 53 1/30/2021
Show less