Update README.md
This commit is contained in:
parent
34ae0794e1
commit
c825c58bd1
22
README.md
22
README.md
|
@ -28,7 +28,6 @@ Client matrix = Client("famedly talk");
|
||||||
3. Connect to a Matrix Homeserver and listen to the streams:
|
3. Connect to a Matrix Homeserver and listen to the streams:
|
||||||
|
|
||||||
```dart
|
```dart
|
||||||
matrix.homeserver = "https://yourhomeserveraddress";
|
|
||||||
|
|
||||||
matrix.connection.onLoginStateChanged.stream.listen((bool loginState){
|
matrix.connection.onLoginStateChanged.stream.listen((bool loginState){
|
||||||
print("LoginState: ${loginState.toString()}");
|
print("LoginState: ${loginState.toString()}");
|
||||||
|
@ -42,26 +41,9 @@ matrix.connection.onRoomUpdate.stream.listen((RoomUpdate eventUpdate){
|
||||||
print("New room update!");
|
print("New room update!");
|
||||||
});
|
});
|
||||||
|
|
||||||
final loginResp = await matrix.connection.jsonRequest(
|
final bool serverValid = await matrix.checkServer("https://yourhomeserver.abc");
|
||||||
type: "POST",
|
|
||||||
action: "/client/r0/login",
|
|
||||||
data: {
|
|
||||||
"type": "m.login.password",
|
|
||||||
"user": _usernameController.text,
|
|
||||||
"password": _passwordController.text,
|
|
||||||
"initial_device_display_name": "famedly talk"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
matrix.connection.connect(
|
final bool loginValid = await matrix.login("username", "password");
|
||||||
newToken: loginResp["token"],
|
|
||||||
newUserID: loginResp["user_id"],
|
|
||||||
newHomeserver: matrix.homeserver,
|
|
||||||
newDeviceName: "famedly talk",
|
|
||||||
newDeviceID: loginResp["device_id"],
|
|
||||||
newMatrixVersions: ["r0.4.0"],
|
|
||||||
newLazyLoadMembers: false
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Send a message to a Room:
|
4. Send a message to a Room:
|
||||||
|
|
Loading…
Reference in a new issue