You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 5, 2022. It is now read-only.
It is encouraged you set an unmarshal hook for thread-safety. Go's `bytes.Buffer` is not thread safe. Sharing a `bytes.Buffer`
46
+
across multiple goroutines introduces risk of panics when decoding json [source](https://github.com/Fallenstedt/twitter-stream/issues/13).
47
+
To avoid panics, it's encouraged to unmarshal json in the same goroutine where the `bytes.Buffer` exists. Use `SetUnmarshalHook` to set a function that unmarshals json.
48
+
49
+
By default, twitterstream's unmarshal hook will return `[]byte` if you want to live dangerously.
Start your stream. This is a long-running HTTP GET request.
46
69
You can get specific data you want by adding [query params](https://developer.twitter.com/en/docs/twitter-api/tweets/filtered-stream/api-reference/get-tweets-search-stream).
47
-
Additionally, [view an example of query params here](https://developer.twitter.com/en/docs/twitter-api/expansions).
70
+
Additionally, [view an example of query params here](https://developer.twitter.com/en/docs/twitter-api/expansions), or in the [examples](https://github.com/fallenstedt/twitter-stream/tree/master/example)
48
71
49
72
```go
50
73
err:= api.Stream.StartStream("")
@@ -54,7 +77,7 @@ Additionally, [view an example of query params here](https://developer.twitter.c
54
77
}
55
78
```
56
79
57
-
4.Consume Messages from the Stream
80
+
Consume Messages from the Stream
58
81
Handle any `io.EOF` and other errors that arise first, then unmarshal your bytes into your favorite struct. Below is an example with strings
0 commit comments