Skip to main content

Getting Started

Add Trixnity to you project

Select from modules the dependency you need and add it to you project:

// get version from https://gitlab.com/trixnity/trixnity/-/releases
val trixnityVersion = "x.x.x"

fun trixnity(module: String, version: String = trixnityVersion) =
"de.connect2x.trixnity:trixnity-$module:$version"

// for example:
implementation(trixnity("client"))

Alternatively, add the Trixnity BOM as a platform dependency. This then allows for version resolution of Trixnity modules:

val trixnityVersion = "x.x.x"

dependencies {
implementation(platform("de.connect2x.trixnity:trixnity-bom:$trixnityVersion"))

// Trixnity dependency versions are covered by the Trixnity BOM
implementation("de.connect2x.trixnity:trixnity-client")
}

Ktor Client engine

Modules containing -client in the name (for example trixnity-client or trixnity-clientserverapi-client) also need a Ktor client engine, that can be found here.

Close a Client

Many classes and functions in Trixnity have optional httpClientEngine and httpClientConfig parameters. These allow to reuse a HttpClientEngine (which is highly recommended) and configure the underlying HttpClient.

Additionally, you should always close() a class or use use, when not needed anymore. For example

httpClient.close()
MatrixClientServerApiClientImpl().use {
// do something
}

Browser Tests

If you are running Kotlin Browser tests using Karma, you will most likely run into the following bug.

To work around this issue, take a look at this config.

Examples

If you want to see Trixnity in action, take a look into the trixnity-examples. You may also take a look into the integration tests.

For a messenger implementation you can take a look into the community project Smalk.

If you you just want to implement a messenger without having to dive too deep into trixnity-client and Matrix, consider using trixnity-messenger.

dev builds

Dev builds are published on each commit to main. Add https://gitlab.com/api/v4/projects/26519650/packages/maven to your maven repositories. You can find the complete version names here ( containing DEV): https://gitlab.com/trixnity/trixnity/-/packages?search[]=trixnity-bom