Update README.md
This commit is contained in:
parent
5fe0b4015f
commit
34ae0794e1
12
README.md
12
README.md
|
@ -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: {
|
||||||
|
|
Loading…
Reference in a new issue