Meowtrix.Sdk
1.1.0
dotnet add package Meowtrix.Sdk --version 1.1.0
NuGet\Install-Package Meowtrix.Sdk -Version 1.1.0
<PackageReference Include="Meowtrix.Sdk" Version="1.1.0" />
<PackageVersion Include="Meowtrix.Sdk" Version="1.1.0" />
<PackageReference Include="Meowtrix.Sdk" />
paket add Meowtrix.Sdk --version 1.1.0
#r "nuget: Meowtrix.Sdk, 1.1.0"
#:package Meowtrix.Sdk@1.1.0
#addin nuget:?package=Meowtrix.Sdk&version=1.1.0
#tool nuget:?package=Meowtrix.Sdk&version=1.1.0
Meowtrix .NET SDK
This open-source library allows you to build .NET apps compatible with Matrix Protocol. It has support for a limited subset of the APIs presently.
This SDK was built for interaction with the Beacon Node. It supports login through the crypto_auth_provider.py.
Supported Platforms
- .NET Standard 2.0 or greater
Installation
Meowtrix .NET SDK is available on NuGet:
dotnet add package Meowtrix.Sdk
Use the SDK in your app
Here is step by step guide:
1. Create
Use MatrixClientFactory to create an instance of MatrixClient
var factory = new MatrixClientFactory();
IMatrixClient client = factory.Create();
2. Login
Currently, MatrixClient supports only Password login or Token re-login.
await client.LoginAsync(matrixNodeAddress, username, password, deviceId);
3. Start listening for incoming events
To listen for the incoming Matrix room events you need to subscribe to OnMatrixRoomEventsReceived;
client.OnMatrixRoomEventsReceived += (sender, eventArgs) =>
{
foreach (BaseRoomEvent roomEvent in eventArgs.MatrixRoomEvents)
{
if (roomEvent is not TextMessageEvent textMessageEvent)
continue;
(string roomId, string senderUserId, string message) = textMessageEvent;
if (client.UserId != senderUserId)
Console.WriteLine($"RoomId: {roomId} received message from {senderUserId}: {message}.");
}
};
I recommend that you don't use anonymous functions to subscribe to events if you have to unsubscribe from the event at some later point in your code.
Then you should start MatrixClient
client.Start();
If you need to stop listening, for example, when the app is suspended, then do the following
client.Stop();
4. Basic functions
// Create room
CreateRoomResponse createRoomResponse = await client.CreateTrustedPrivateRoomAsync(new[]
{
anotherClient.UserId
});
// Join room
await anotherClient.JoinTrustedPrivateRoomAsync(createRoomResponse.RoomId);
// Send message
await client.SendMessageAsync(createRoomResponse.RoomId, "some message");
// Get joined rooms ids
await client.GetJoinedRoomsIdsAsync();
// Leave room
await client.LeaveRoomAsync(roomId);
5. Status check
IsLoggedIn - matrix login status.
IsSyncing - sync. Read more about syncing here.
Console.WriteLine($"client.IsLoggedIn: {client.IsLoggedIn}");
Console.WriteLine($"client.IsSyncing: {client.IsSyncing}");
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. 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 was computed. 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 was computed. 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 was computed. |
| .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
- Markdig (>= 0.31.0)
- Microsoft.Extensions.Http (>= 5.0.0)
- Newtonsoft.Json (>= 13.0.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.