Gntp.Net
2.0.1
dotnet add package Gntp.Net --version 2.0.1
NuGet\Install-Package Gntp.Net -Version 2.0.1
<PackageReference Include="Gntp.Net" Version="2.0.1" />
<PackageVersion Include="Gntp.Net" Version="2.0.1" />
<PackageReference Include="Gntp.Net" />
paket add Gntp.Net --version 2.0.1
#r "nuget: Gntp.Net, 2.0.1"
#:package Gntp.Net@2.0.1
#addin nuget:?package=Gntp.Net&version=2.0.1
#tool nuget:?package=Gntp.Net&version=2.0.1
Gntp.Net
Production-ready GNTP (Growl Notification Transport Protocol) client for .NET with full Windows/Android/macOS/Linux compatibility and callback support.
✨ Features
- ✅ Full GNTP 1.0 protocol implementation
- ✅ Async/await support for modern .NET
- ✅ Callback support (click, close, timeout events)
- ✅ Multiple icon delivery modes (Binary, File URL, Data URL, HTTP URL)
- ✅ Cross-platform (Windows, macOS, Linux, Android)
- ✅ Multi-targeting (.NET Standard 2.0/2.1, .NET 6/7/8)
- ✅ Zero dependencies - pure .NET implementation
- ✅ Fully documented with XML comments
📦 Installation
dotnet add package Gntp.Net
Or via NuGet Package Manager:
Install-Package Gntp.Net
🚀 Quick Start
using Gntp.Net;
// Create client
var client = new GntpClient("My Application");
// Define notification type
var notification = new NotificationType("alert")
.WithDisplayName("Alert Notification");
// Register
await client.RegisterAsync(notification);
// Send notification
await client.NotifyAsync("alert", "Hello", "This is a test notification");
📋 Examples
Basic Notification
var client = new GntpClient("My App");
var notification = new NotificationType("alert");
await client.RegisterAsync(notification);
await client.NotifyAsync("alert", "Title", "Message");
With Icon
var client = new GntpClient("Icon App")
.WithIconMode(IconMode.Binary); // Best for Windows
var icon = GntpResource.FromFile("icon.png");
var notification = new NotificationType("alert")
.WithIcon(icon);
await client.RegisterAsync(notification);
await client.NotifyAsync("alert", "With Icon!", "This has an icon");
With Callbacks (IMPORTANT!)
var client = new GntpClient("Callback App");
await client.WithCallbackAsync(info =>
{
Console.WriteLine($"Event: {info.Type}");
Console.WriteLine($"Context: {info.Context}");
switch (info.Type)
{
case CallbackType.Click:
Console.WriteLine("User clicked!");
break;
case CallbackType.Close:
Console.WriteLine("User closed");
break;
case CallbackType.Timeout:
Console.WriteLine("Timed out");
break;
}
});
var notification = new NotificationType("alert");
await client.RegisterAsync(notification);
var options = new NotifyOptions()
.WithSticky(true)
.WithCallbackContext("user_data_123")
.WithCallbackTarget("https://example.com");
await client.NotifyAsync("alert", "Click Me!", "Message", options);
// Keep app running to receive callbacks
Console.ReadKey();
client.Dispose();
Multiple Notification Types
var client = new GntpClient("Multi-Type App");
var info = new NotificationType("info").WithDisplayName("Information");
var warning = new NotificationType("warning").WithDisplayName("Warning");
var error = new NotificationType("error").WithDisplayName("Error");
await client.RegisterAsync(info, warning, error);
await client.NotifyAsync("info", "Info", "Something happened");
await client.NotifyAsync("warning", "Warning", "Be careful!");
await client.NotifyAsync("error", "Error", "Something went wrong!");
Remote Notifications
var client = new GntpClient("Remote App")
.WithHost("192.168.1.100")
.WithPort(23053);
Notification Options
var options = new NotifyOptions()
.WithSticky(true) // Stays until dismissed
.WithPriority(2) // Emergency priority (-2 to 2)
.WithIcon(icon) // Per-notification icon
.WithCallbackContext("data") // Custom callback data
.WithCallbackTarget("https://example.com"); // URL to open
await client.NotifyAsync("alert", "Title", "Text", options);
🎯 Icon Delivery Modes
Binary Mode (Recommended for Windows)
var client = new GntpClient("App")
.WithIconMode(IconMode.Binary);
Format: x-growl-resource://UUID + binary data
Best for: Windows Growl, macOS, Linux
✅ Tested and working on all platforms
DataURL Mode
var client = new GntpClient("App")
.WithIconMode(IconMode.DataUrl);
Format: data:image/png;base64,iVBORw0...
Best for: Android, fallback option
⚠️ May have issues with large icons
FileURL Mode
var client = new GntpClient("App")
.WithIconMode(IconMode.FileUrl);
Format: file:///C:/full/path/to/icon.png
Best for: Shared icons on disk
⚠️ Requires absolute path
HttpURL Mode
var client = new GntpClient("App")
.WithIconMode(IconMode.HttpUrl);
Format: http://example.com/icon.png
Best for: Web-hosted icons
🌍 Platform Compatibility
| Platform | Binary Mode | DataURL Mode | Callbacks | Recommended |
|---|---|---|---|---|
| Windows (Growl for Windows) | ✅ Works | ⚠️ Issues | ✅ Works | Binary |
| macOS (Growl) | ✅ Works | ✅ Works | ✅ Works | Binary |
| Linux (Growl-compatible) | ✅ Works | ✅ Works | ✅ Works | Binary |
| Android (Growl for Android) | ✅ Works | ✅ Works | ✅ Works | Binary or DataURL |
🔔 Callback Events
Callbacks are triggered when users interact with notifications:
CallbackType.Click- User clicked the notificationCallbackType.Close- User closed the notificationCallbackType.Timeout- Notification timed out
await client.WithCallbackAsync(info =>
{
// info.Type - Event type
// info.NotificationId - Notification ID
// info.Context - Custom data
// info.Timestamp - Event time
});
📚 API Reference
GntpClient
// Constructor
new GntpClient(string applicationName)
// Configuration
.WithHost(string host)
.WithPort(int port)
.WithIcon(GntpResource icon)
.WithIconMode(IconMode mode)
.WithDebug(bool debug)
.WithTimeout(int timeout)
.WithCallbackAsync(Action<CallbackInfo> handler)
// Operations
await RegisterAsync(params NotificationType[] notifications)
await NotifyAsync(string name, string title, string text)
await NotifyAsync(string name, string title, string text, NotifyOptions options)
GntpResource
// Static factory methods
GntpResource.FromFile(string path)
GntpResource.FromBytes(byte[] data, string mimeType)
// Instance methods
string GetReference(IconMode mode)
string ToDataUrl()
🐛 Troubleshooting
Icon Not Showing
Try Binary mode (most reliable):
client.WithIconMode(IconMode.Binary);
Callbacks Not Working
Ensure:
- Callback is set BEFORE
RegisterAsync() - App stays running to receive callbacks
- Call
client.Dispose()when done - Firewall allows incoming connections
Android Connection Issues
Use longer timeout:
client.WithTimeout(15000); // 15 seconds
🤝 Contributing
Contributions welcome! Please open an issue or PR.
📄 License
MIT License - See LICENSE file for details.
👤 Author
🙏 Related Projects
- Rust gntp: https://github.com/cumulus13/gntp
- Go go-gntp: https://github.com/cumulus13/go-gntp
- Python gntplib: https://github.com/cumulus13/gntplib
Production-ready GNTP client for .NET with full cross-platform support and callback functionality!
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
-
.NETStandard 2.1
- No dependencies.
-
net6.0
- No dependencies.
-
net7.0
- No dependencies.
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.1 | 172 | 12/20/2025 |
Version 2.0.1
- Production-ready GNTP client
- Multi-platform support
- Callback and icon delivery modes
- Nullable reference types enabled