From 5391ef3078bf435e893bea58992583cc98096ab0 Mon Sep 17 00:00:00 2001 From: Kegan Dougal Date: Wed, 30 Nov 2016 17:51:03 +0000 Subject: [PATCH] Add working example --- client.go | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/client.go b/client.go index dc82357..cbc62f7 100644 --- a/client.go +++ b/client.go @@ -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