Update README.md

This commit is contained in:
Christian 2019-06-09 12:42:19 +00:00
parent 5fe0b4015f
commit 34ae0794e1
1 changed files with 6 additions and 6 deletions

View File

@ -30,19 +30,19 @@ Client matrix = Client("famedly talk");
```dart ```dart
matrix.homeserver = "https://yourhomeserveraddress"; matrix.homeserver = "https://yourhomeserveraddress";
matrix.onLoginStateChanged.stream.listen((bool loginState){ matrix.connection.onLoginStateChanged.stream.listen((bool loginState){
print("LoginState: ${loginState.toString()}"); print("LoginState: ${loginState.toString()}");
}); });
matrix.onEvent.stream.listen((EventUpdate eventUpdate){ matrix.connection.onEvent.stream.listen((EventUpdate eventUpdate){
print("New event update!"); print("New event update!");
}); });
matrix.onRoomUpdate.stream.listen((RoomUpdate eventUpdate){ matrix.connection.onRoomUpdate.stream.listen((RoomUpdate eventUpdate){
print("New room update!"); print("New room update!");
}); });
final loginResp = await matrix.jsonRequest( final loginResp = await matrix.connection.jsonRequest(
type: "POST", type: "POST",
action: "/client/r0/login", action: "/client/r0/login",
data: { data: {
@ -53,7 +53,7 @@ final loginResp = await matrix.jsonRequest(
} }
); );
matrix.connect( matrix.connection.connect(
newToken: loginResp["token"], newToken: loginResp["token"],
newUserID: loginResp["user_id"], newUserID: loginResp["user_id"],
newHomeserver: matrix.homeserver, newHomeserver: matrix.homeserver,
@ -67,7 +67,7 @@ matrix.connect(
4. Send a message to a Room: 4. Send a message to a Room:
```dart ```dart
final resp = await jsonRequest( final resp = await matrix.connection.jsonRequest(
type: "PUT", type: "PUT",
action: "/r0/rooms/!fjd823j:example.com/send/m.room.message/$txnId", action: "/r0/rooms/!fjd823j:example.com/send/m.room.message/$txnId",
data: { data: {