Add streaming list support.

pull/94/head
Ben Lubar 2019-04-26 20:53:58 -05:00 committed by mattn
parent 6f05c48bf6
commit 3e2bdc63c7
2 changed files with 13 additions and 0 deletions

View File

@ -156,3 +156,11 @@ func (c *Client) StreamingHashtag(ctx context.Context, tag string, isLocal bool)
return c.streaming(ctx, p, params)
}
// StreamingList return channel to read events on a list.
func (c *Client) StreamingList(ctx context.Context, id ID) (chan Event, error) {
params := url.Values{}
params.Set("list", string(id))
return c.streaming(ctx, "list", params)
}

View File

@ -51,6 +51,11 @@ func (c *WSClient) StreamingWSHashtag(ctx context.Context, tag string, isLocal b
return c.streamingWS(ctx, s, tag)
}
// StreamingWSList return channel to read events on a list using WebSocket.
func (c *WSClient) StreamingWSList(ctx context.Context, id ID) (chan Event, error) {
return c.streamingWS(ctx, "list", string(id))
}
func (c *WSClient) streamingWS(ctx context.Context, stream, tag string) (chan Event, error) {
params := url.Values{}
params.Set("access_token", c.client.config.AccessToken)