Matrix.Sdk 0.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Matrix.Sdk --version 0.0.1
                    
NuGet\Install-Package Matrix.Sdk -Version 0.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Matrix.Sdk" Version="0.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Matrix.Sdk" Version="0.0.1" />
                    
Directory.Packages.props
<PackageReference Include="Matrix.Sdk" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Matrix.Sdk --version 0.0.1
                    
#r "nuget: Matrix.Sdk, 0.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=Matrix.Sdk&version=0.0.1
                    
Install Matrix.Sdk as a Cake Addin
#tool nuget:?package=Matrix.Sdk&version=0.0.1
                    
Install Matrix.Sdk as a Cake Tool

Matrix .NET SDK

matrix-logo

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.

Use the SDK in your app

For a complete example, refer to SimpleExample.cs. You can also clone this repository and run Matrix.Sdk.Sample.Console.

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.

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
MatrixRoom matrixRoom = await client.CreateTrustedPrivateRoomAsync(new[]
{
    anotherClient.UserId
});

// Join room
await anotherClient.JoinTrustedPrivateRoomAsync(matrixRoom.Id);

// Send message
await client.SendMessageAsync(matrixRoom.Id, "some message");

//Get joined rooms ids
await client.GetJoinedRoomsIdsAsync();

// Leave room
await client.LeaveRoomAsync(roomId);
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Matrix.Sdk:

Package Downloads
Beacon.Sdk

Beacon .NET SDK for Tezos wallet / dApps developers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.9 713 3/13/2024
1.0.8 1,297 3/16/2023
1.0.7 2,062 11/7/2022
1.0.6 700 10/27/2022
1.0.5 1,506 10/13/2022
1.0.4 891 10/8/2022
1.0.3 1,280 8/30/2022
1.0.2 674 8/30/2022
1.0.1 422 8/29/2022
1.0.0 701 8/26/2022
0.0.7 1,440 1/20/2022
0.0.6 464 1/19/2022
0.0.5 467 12/13/2021
0.0.4 1,166 12/3/2021
0.0.3 473 11/19/2021
0.0.2 390 11/18/2021
0.0.1 427 11/18/2021