GLib based library to communicate with Matrix.org homeservers
Go to file
Gergely Polonkai 5fedf09f76 Define polling-started and polling-stopped signals
Client.sync() invokes them when polling is started or stopped for any
reason.

Signed-off-by: Gergely Polonkai <gergely@polonkai.eu>
2016-03-21 15:48:31 +01:00
docs Remove final traces of old documentation 2016-03-05 07:35:20 +00:00
m4 Update autotools to Vala usage 2016-03-04 14:00:06 +01:00
src Define polling-started and polling-stopped signals 2016-03-21 15:48:31 +01:00
vapi Move internal vapis to a separate directory 2016-03-05 07:35:55 +00:00
.gitignore Add Matrix.Room to hold room data 2016-03-16 17:09:30 +00:00
AUTHORS Add AUTHORS, NEWS and README files 2016-02-22 14:54:15 +01:00
autogen.sh Move documentation generating to Valadoc 2016-03-04 14:52:22 +01:00
CODE_OF_CONDUCT.md Add code of conduct and contact to README 2016-03-17 20:17:21 +00:00
configure.ac Move namespace-info.vala to namespace-info.vala.in 2016-03-10 19:08:33 +01:00
CONTRIBUTING.md Add contribution details 2016-03-18 19:30:50 +00:00
COPYING Add COPYING file 2016-02-21 23:17:35 +01:00
Makefile.am Move documentation generating to Valadoc 2016-03-04 14:52:22 +01:00
NEWS Add AUTHORS, NEWS and README files 2016-02-22 14:54:15 +01:00
README Add AUTHORS, NEWS and README files 2016-02-22 14:54:15 +01:00
README.md Add contribution details 2016-03-18 19:30:50 +00:00
vala-globals.mk Move internal vapis to a separate directory 2016-03-05 07:35:55 +00:00

Matrix Client SDK for GLib

This is a Matrix.org client-server SDK for GLib >= 2.40. It contains both raw API calls and a signal based asynchronous client. The API and ABI are both very volatile as of now; dont rely on any specific feature until the API is frozen.

The main interfaces are MatrixAPI and MatrixClient. MatrixHTTPAPI and MatrixHTTPClient implement these interfaces, respectively and can communicate with an HTTP based homeserver. If a new protocol becomes supported oficially, a new API and Client class will be added.

Usage

The SDK provides two layers of interaction. The low-level layer (MatrixAPI implementations like MatrixHTTPAPI) just wraps the raw API calls. The high-level layer (MatrixClient implementations like MatrixHTTPClient) is a GMainLoop based asynchronous object that emits GObject signals and uses the low-level layer to provide an object model to perform actions on.

Client

For a working example, see test-client.c.

// Create a client object
MatrixClient *client = MATRIX_CLIENT(matrix_http_client_new("http://localhost:8008"));

// Set tokens for the session. Alternatively you may want to login with matrix_api_login() or matrix_client_login_with_password()
matrix_api_set_token(MATRIX_API(client), "your_access_token");
matrix_api_set_refresh_token(MATRIX_API(client), "your_refresh_token");

// Connect a callback that gets called when a m.room.message event arrives
matrix_client_connect_event(client, MATRIX_EVENT_TYPE_ROOM_MESSAGE, message_callback, NULL);

// Enter polling mode. This continuously calls the /sync API
matrix_client_begin_polling(client);

// Now enter a main loop with g_main_loop_run() so polling for events can actually begin

API

For a full blown example, see test-api-client.c.

Contribution

See the file CONTRIBUTING.md for details.

Code of Conduct

See the file CODE_OF_CONDUCT.md for details.

Contact

Should you need any help, join us in Matrix at #matrix-glib-sdk:polonkai.eu.