Add working example

This commit is contained in:
Kegan Dougal 2016-11-30 17:51:03 +00:00
parent 519d03ed04
commit 5391ef3078
1 changed files with 8 additions and 10 deletions

View File

@ -3,16 +3,14 @@
// 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)
// })
// if err := cli.Sync(); err != nil {
// panic(err)
// }
// 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 {
// fmt.Println("Sync() returned ", err)
// }
//
// To make the example non-blocking, call Sync() in a goroutine.
package gomatrix