[twitter-dev] User streams and track

2011-02-18 Thread WushuJames
Hi,

What does it mean to do track on a user stream? I had thought that
it would just be like my user stream but filtered to just those tweets
that have the keyword/hashtag. But, when I actually do it, i see a
stream of public tweets that match that track keyword, not just the
ones from the people I follow.

Does track in fact work with user streams in the way I was thinking?
If not, what is the recommended way for me to get just tweets on my
user stream that match a given hashtag. Should I just match against
the entities block myself?

Here is what I'm sending:

POST /2/user.json HTTP/1.1
Host: userstream.twitter.com
Accept-Encoding: identity
Content-Length: 28
Content-type: application/x-www-form-urlencoded
Authorization: OAuth realm=, oauth_version=1.0,
oauth_signature=XX, oauth_nonce=XX,
oauth_timestamp=XX, oauth_token=XX,
oauth_consumer_key=XX, oauth_signature_method=XX

track=appledelimited=length

And here is what is being returned:
HTTP/1.1 200 OK
Content-Type: application/json
Transfer-Encoding: chunked
Server: Jetty(6.1.25)

followed by the friends list and messages

Thanks,
-James

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk


[twitter-dev] delimited=length and newlines?

2011-02-16 Thread WushuJames
Hi,

In http://dev.twitter.com/pages/streaming_api_methods#delimited, it says:
Statuses are represented by a length, in bytes, a newline, and the status 
text that is exactly length bytes. Note that “keep-alive” newlines may be 
inserted before each length.

I was thinking newline meant \n. But upon inspecting the stream, it looks 
like lines end with \r\n, which I would call carriage return newline. Is my 
terminology wrong, or do the docs need to be more precise?

Also, the newlines may be inserted before each length part. Does that mean 
a stream of messages would be

length\r\nstatus-text (first message)

\r\nlength\r\nstatus-text (second message)

Or is it:
length\r\nstatus-text\r\n (first message)

length\r\nstatus-text\r\n (second message)

Thanks!
-James


-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk


[twitter-dev] User Streams and delimited=length

2011-02-16 Thread WushuJames
Hi,

I'm playing around with User Streams. I was able to connect to 
https://userstream.twitter.com/2/user.json authenticated via OAuth and can 
see data coming in. 

I'm having trouble getting delimited=length working with User Streams. Or 
rather, I'm not sure if I'm using it correctly. I'm doing a POST and passing 
delimited=length in the body of my post.

Here's what I see when I connect:
1) First, a list of friends as documented at 
http://dev.twitter.com/pages/user_streams, followed by \r\n
Example:
{friends:[1497,169686021,790205,15211564,37784836,821958,14884312,92015003,822571,63846421...]}\r\n

2) Next, an empty line containing \r\n

3) the messages. The messages are JSON, and the line ends in \r\n. For 
example, I see: 
{ ...somejson... }\r\n
{ ...somejson... }\r\n
{ ...somejson... }\r\n

Is delimited=length supposed to work with user streams? Am I passing in the 
parameter correctly? (as POST variables in the body) Should I be passing 
delimited=length as GET variables in the URL? That didn't seem to work 
either, my request got rejected with a 401 HTTP error.

Thanks,
-James

-- 
Twitter developer documentation and resources: http://dev.twitter.com/doc
API updates via Twitter: http://twitter.com/twitterapi
Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list
Change your membership to this group: 
http://groups.google.com/group/twitter-development-talk