streams.go
changeset 244 4508376c8fcb
parent 238 1c0042e76902
equal deleted inserted replaced
243:7386c6a454a8 244:4508376c8fcb
    23 }
    23 }
    24 
    24 
    25 // openStream opens a stream URL and returns an http.Response
    25 // openStream opens a stream URL and returns an http.Response
    26 // Note that the caller should close the connection when it's done reading
    26 // Note that the caller should close the connection when it's done reading
    27 // the stream.
    27 // the stream.
    28 // The stream name can be "user", "local", "public", "list" or "hashtag".
    28 // The stream name can be "user", "local", "public", "direct", "list" or
       
    29 // "hashtag".
    29 // When it is "hashtag", the param argument contains the hashtag.
    30 // When it is "hashtag", the param argument contains the hashtag.
    30 // When it is "list", the param argument contains the list ID.
    31 // When it is "list", the param argument contains the list ID.
    31 func (mc *Client) openStream(streamName, param string) (*websocket.Conn, error) {
    32 func (mc *Client) openStream(streamName, param string) (*websocket.Conn, error) {
    32 	var tag, list string
    33 	var tag, list string
    33 
    34 
    34 	switch streamName {
    35 	switch streamName {
    35 	case "user", "public", "public:local":
    36 	case "user", "public", "public:local", "direct":
    36 	case "hashtag":
    37 	case "hashtag":
    37 		if param == "" {
    38 		if param == "" {
    38 			return nil, ErrInvalidParameter
    39 			return nil, ErrInvalidParameter
    39 		}
    40 		}
    40 		tag = param
    41 		tag = param