Enum egg_mode::stream::StreamMessage
source · pub enum StreamMessage {
Ping,
FriendList(Vec<u64>),
Tweet(Tweet),
Delete {
status_id: u64,
user_id: u64,
},
ScrubGeo {
user_id: u64,
up_to_status_id: u64,
},
StatusWithheld {
status_id: u64,
user_id: u64,
withheld_in_countries: Vec<String>,
},
UserWithheld {
user_id: u64,
withheld_in_countries: Vec<String>,
},
Disconnect(u64, String),
Unknown(Value),
}
Expand description
Represents the kinds of messages that can be sent over Twitter’s Streaming API.
Variants§
Ping
A blank line, sent periodically to keep the connection alive.
FriendList(Vec<u64>)
A list of accounts the authenticated user follows, sent at the beginning of the session for user streams.
Tweet(Tweet)
A new tweet.
Note that the entities
inside the user
field will be empty for tweets received via the
Streaming API.
Delete
Notice given when a user deletes a post.
Clients are expected to comply with these notices by removing the status “from memory and any storage or archive, even in the rare case where a deletion message arrives earlier in the stream than the Tweet it references.”
ScrubGeo
Fields
Notice given when a user removes geolocation information from their profile.
Clients are expected to comply by deleting cached geolocation information from tweets by the given user, for any tweets up to and including the given status ID. According to Twitter’s documentation, “These messages may also arrive before a Tweet which falls into the specified range, although this is rare.”
StatusWithheld
Fields
Placeholder message used to indicate that a specific tweet has been withheld in certain countries.
UserWithheld
Fields
Placeholder message used to indicate that a specific user’s content has been withheld in certain countries.
Disconnect(u64, String)
An error message that may be delivered immediately prior to Twitter disconnecting the stream.
Note that if the stream is disconnected due to network issues or the client reading messages too slowly, it’s possible that this message may not be received.
The enclosed values are an error code and error description. A non-exhaustive list of error codes and their associated reasons are available on Twitter’s stream docmentation, under “Disconnect messages (disconnect)”.
Unknown(Value)
An unhandled message payload.
Twitter can add new streaming messages to the API, and egg-mode includes them here so that they can be used before egg-mode has a chance to handle them.