From 84aac42bf12f1b88f8c65627d8de169a5a8c36d5 Mon Sep 17 00:00:00 2001 From: Alex Fallenstedt Date: Sat, 9 Jan 2021 11:26:06 -0800 Subject: [PATCH] update readme --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f45a027..52bb6e6 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,18 @@ This project is not production ready. There are several things I need to do: #### Starting a stream +Once you obtain an Access Token, you can create a TwitterStream instance with `NewTwitterStream(accesToken)` +Then, you can invoke `StartStream` to begin the streaming process. + +To read messages from your stream, start a loop with `GetMessages`. The messages that is returned could be +a tweet, or an error. + +The possible errors that can be returned are +* `io.EOF`: An error that you have reached the end of the stream. +* `non io.EOF errors`: This could be errors that are returned from Twitter during your stream + +[You can learn more about processing data by reading Twitter's documentation here](https://dev.twitter.com/streaming/overview/processing) + ```go // Starting a stream assuming you already have // stream rules set in place @@ -47,7 +59,7 @@ func startStreaming() { // If you do not put this in a go routine, you will stream forever go func() { - // Range over the messages channel to get a message + // Range over the messages channel to get a message, or an error. for message := range *api.Stream.GetMessages() { fmt.Println(message) }