{"id":20058880,"url":"https://github.com/ably-labs/pubsub-demo-dotnet","last_synced_at":"2025-07-01T22:33:36.298Z","repository":{"id":39588643,"uuid":"467584446","full_name":"ably-labs/pubsub-demo-dotnet","owner":"ably-labs","description":"Sample app to demonstrate how to do pub/sub using the Ably .NET SDK.","archived":false,"fork":false,"pushed_at":"2023-07-03T11:05:36.000Z","size":2836,"stargazers_count":4,"open_issues_count":3,"forks_count":1,"subscribers_count":16,"default_branch":"main","last_synced_at":"2025-05-05T15:46:37.780Z","etag":null,"topics":["console","dotnet","pubsub","realtime"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ably-labs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-08T16:10:33.000Z","updated_at":"2023-06-01T06:58:53.000Z","dependencies_parsed_at":"2025-05-05T15:48:45.977Z","dependency_job_id":"73f0c9d5-de6a-492a-9a22-539d453ae542","html_url":"https://github.com/ably-labs/pubsub-demo-dotnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"ably-labs/ably-labs-template-repo","purl":"pkg:github/ably-labs/pubsub-demo-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fpubsub-demo-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fpubsub-demo-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fpubsub-demo-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fpubsub-demo-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ably-labs","download_url":"https://codeload.github.com/ably-labs/pubsub-demo-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ably-labs%2Fpubsub-demo-dotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263046864,"owners_count":23405277,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["console","dotnet","pubsub","realtime"],"created_at":"2024-11-13T13:04:44.783Z","updated_at":"2025-07-01T22:33:36.260Z","avatar_url":"https://github.com/ably-labs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pub/Sub Demo using .NET 6\n\n![Console chat demo with two publishers and two subscribers](media/console_chat.gif)\n\n## Description\n\nThis is a .NET 6 console application that demonstrates how [Ably](https://ably.com) can be used for pub/sub messaging. You can read all about this demo in this [blog post](https://ably.com/blog/use-pub-sub-to-build-a-chat-app-with-csharp-net).\n\n## Tech stack\n\nThe project uses the following components:\n\n- [.NET 6](https://dotnet.microsoft.com/download/dotnet/6.0), .NET 6 SDK.\n- [Spectre.Console](https://spectreconsole.net/), a library to make beautiful console applications.\n- [Ably](https://ably.com/?utm_campaign=GLB-2203-pubsub-demo-dotnet\u0026utm_content=repo-pubsub-demo-dotnet\u0026utm_source=github\u0026utm_medium=repo\u0026src=GLB-2203-pubsub-demo-dotnet-github), for real-time messaging at scale.\n\n## Building \u0026 running locally\n\n### Prerequisites\n\n1. Install the [.NET 6 SDK](https://dotnet.microsoft.com/download/dotnet/6.0) .\n2. [Sign up](https://ably.com/signup?utm_campaign=GLB-2203-pubsub-demo-dotnet\u0026utm_content=repo-pubsub-demo-dotnet\u0026utm_source=github\u0026utm_medium=repo\u0026src=GLB-2203-pubsub-demo-dotnet-github) or [log in](https://ably.com/login?utm_campaign=GLB-2203-pubsub-demo-dotnet\u0026utm_content=repo-pubsub-demo-dotnet\u0026utm_source=github\u0026utm_medium=repo\u0026src=GLB-2203-pubsub-demo-dotnet-github) to ably.com, and [create a new app and copy the API key](https://faqs.ably.com/setting-up-and-managing-api-keys?utm_campaign=GLB-2203-pubsub-demo-dotnet\u0026utm_content=repo-pubsub-demo-dotnet\u0026utm_source=github\u0026utm_medium=repo\u0026src=GLB-2203-pubsub-demo-dotnet-github).\n3. Clone this repository to your local machine.\n\n### Building \u0026 running the project\n\n1. Build the console app by running `dotnet build` in the `src\\ConsoleChat` folder.\n   \u003e The executable is located in the `src\\ConsoleChat\\bin\\Debug\\net6.0` folder.\n2. Start one instance of the application in the publisher mode:\n\n    ```powershell\n    .\\ConsoleChat.exe pub \u003cChannelName\u003e \u003cAblyApiKey\u003e\n    ```\n\n    \u003e Ably will create a new channel if it doesn't yet exist.\n\n3. Start one instance of the application in the subscriber mode:\n\n    ```powershell\n    .\\ConsoleChat.exe sub \u003cChannelName\u003e \u003cAblyApiKey\u003e\n    ```\n\n    \u003e Use the same channel \u0026 API key as in step 2.\n\nAlternatively, you can start the application in Debug mode in VSCode by pressing `F5`. The `launch.json` contains input arguments and this instructs VSCode to show input fields when the application is run in debug mode:\n\n![Input fields when debugging in VSCode](media/%20console_chat_vscode_debug.gif)\n\n### Publishing the application\n\nIn case you want to publish and distribute this console app to use this with your co-workers or friends, you need to do the following:\n\n1. Ensure you're in the folder where the *csproj* file is located.\n2. Run the [`dotnet publish`](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish) command:\n\n    ```shell\n    dotnet publish -c Release -r \u003cRUNTIME_IDENTFIER\u003e --self-contained=false /p:PublishSingleFile=true\n    ```\n\n    Example for windows x64 machines:\n\n    ```shell\n    dotnet publish -c Release -r win-x64 --self-contained=false /p:PublishSingleFile=true\n    ```\n\n    For more information on the available runtime identifiers, see the [.NET RID Catalog](https://docs.microsoft.com/dotnet/core/rid-catalog).\n\n3. The release version of the application is now available in the `src\\ConsoleChat\\bin\\Release\\net6.0\\\u003cRUNTIME_IDENTIFIER\u003e\\publish` folder.\n\n## Contributing\n\nWant to help contributing to this project? Have a look at our [contributing guide](CONTRIBUTING.md)!\n\n## More info\n\nYou want more information about this sample or using .NET \u0026 Ably in general? Feel free to contact me via [Discord](https://go.ably.com/discord).\n\n- [Join our Discord server](https://go.ably.com/discord)\n- [Follow us on Twitter](https://twitter.com/ablyrealtime)\n- [Use our SDKs](https://github.com/ably/)\n- [Visit our website](https://ably.com?utm_campaign=GLB-2203-pubsub-demo-dotnet\u0026utm_content=repo-pubsub-demo-dotnet\u0026utm_source=github\u0026utm_medium=repo\u0026src=GLB-2203-pubsub-demo-dotnet-github)\n\n---\n[![Ably logo](https://static.ably.dev/badge-black.svg?pubsub-demo-dotnet)](https://ably.com?utm_campaign=GLB-2203-pubsub-demo-dotnet\u0026utm_content=repo-pubsub-demo-dotnet\u0026utm_source=github\u0026utm_medium=repo\u0026src=GLB-2203-pubsub-demo-dotnet-github)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably-labs%2Fpubsub-demo-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fably-labs%2Fpubsub-demo-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fably-labs%2Fpubsub-demo-dotnet/lists"}