mirror of https://github.com/matrix-org/gomatrix
Add working example
This commit is contained in:
parent
519d03ed04
commit
5391ef3078
12
client.go
12
client.go
|
@ -3,15 +3,13 @@
|
|||
// Specification can be found at http://matrix.org/docs/spec/client_server/r0.2.0.html
|
||||
//
|
||||
// Example usage of this library: (blocking version)
|
||||
// cli, err := gomatrix.NewClient("https://matrix.org", "@example:matrix.org", "abcdef123456")
|
||||
// if err != nil {
|
||||
// panic(err)
|
||||
// }
|
||||
// cli.Syncer.OnEventType("m.room.message", func(ev *gomatrix.Event) {
|
||||
// fmt.Println("Message: %+v", ev)
|
||||
// cli, _ := gomatrix.NewClient("https://matrix.org", "@example:matrix.org", "MDAefhiuwehfuiwe")
|
||||
// syncer := cli.Syncer.(*gomatrix.DefaultSyncer)
|
||||
// syncer.OnEventType("m.room.message", func(ev *gomatrix.Event) {
|
||||
// fmt.Println("Message: ", ev)
|
||||
// })
|
||||
// if err := cli.Sync(); err != nil {
|
||||
// panic(err)
|
||||
// fmt.Println("Sync() returned ", err)
|
||||
// }
|
||||
//
|
||||
// To make the example non-blocking, call Sync() in a goroutine.
|
||||
|
|
Loading…
Reference in New Issue