A developer's playground for WPF and .NET Core 3 in the form of a real time "hello world": an instant messenger.
Chatterbox is a basic instant messenger. It consists of two elements:
- A desktop client written with Windows Presentation Foundation (WPF). Multiple instances can run at the same time.
- A command line server written with ASP.NET Core Web Host. Only one instance can be executed.
The application shares a single chat with all connected clients. The server keeps every message in a database to support late joins. ASP.NET Core SignalR is used for the communication between the clients and the server.
The main aim of this endeavour was to play around in a real time scenario with WPF and .NET Core. Such a setup was made possible a few months ago with the .NET Core 3.0 release. In particular, the usage of the following .NET Core features within WPF where of interest:
On top of that, the project offered the possibility to get to know the dependency diagram validation feature of Visual Studio as explained in this tutorial.
To keep the playground simple, the system was developed running on a single host, but little effort would be required to run the application with Internet Information Services (IIS) and a database server.
Both elements of the solution target the .NET Core 3.1 runtime, so make sure you have it's SDK installed.
Run the following statement within the solution's root folder in your command line.
dotnet publish -r win-x64 -c Release --self-contained -o publish/client Chatterbox.Client/Chatterbox.Client.csproj /p:PublishSingleFile=true
This produces a self contained version of the client, which will be located in the folder publish/client.
Run the following statement within the solution's root folder in your command line.
dotnet publish -r win-x64 -c Release --self-contained -o publish/server Chatterbox.Server/Chatterbox.Server.csproj /p:PublishSingleFile=true
This produces a self contained version of the server, which will be located in the folder publish/server.
The following articles will offer further knowledge about certain aspects of Chatterbox.
- Solution architecture
- Resource management with an IServiceProvider
- Connection handling with an IHostedService
This project serves only as a playground. It was written in a short amount of time and its scope is very limited and it is not intended for any usage within a real production environment!
Since it is a sample application, many important features are missing. For example:
- Private- and group-chats
- Authentication
- Authorization
- End-to-end encryption
- Scalability
- Internalization
- Etc.
- MIT license
- Copyright 2020 © Dominic Klemm