Documentation ¶
Index ¶
Constants ¶
const ( // EventTypeNotification -- a user // should be shown a notification. EventTypeNotification = "notification" // EventTypeUpdate -- a user should // be shown an update in their timeline. EventTypeUpdate = "update" // EventTypeDelete -- something // should be deleted from a user. EventTypeDelete = "delete" // EventTypeStatusUpdate -- something in the // user's timeline has been edited (yes this // is a confusing name, blame Mastodon ...). EventTypeStatusUpdate = "status.update" // EventTypeFiltersChanged -- the user's filters // (including keywords and statuses) have changed. EventTypeFiltersChanged = "filters_changed" )
const ( // TimelineLocal: // All public posts originating from this // server. Analogous to the local timeline. TimelineLocal = "public:local" // TimelinePublic: // All public posts known to the server. // Analogous to the federated timeline. TimelinePublic = "public" // TimelineHome: // Events related to the current user, such // as home feed updates and notifications. TimelineHome = "user" // TimelineNotifications: // Notifications for the current user. TimelineNotifications = "user:notification" // TimelineDirect: // Updates to direct conversations. TimelineDirect = "direct" // TimelineList: // Updates to a specific list. TimelineList = "list" )
Variables ¶
var AllStatusTimelines = []string{ TimelineLocal, TimelinePublic, TimelineHome, TimelineDirect, TimelineList, }
AllStatusTimelines contains all Timelines that a status could conceivably be delivered to, useful for sending out status deletes.
Functions ¶
This section is empty.
Types ¶
type Message ¶
type Message struct { // All the stream types this // message should be delivered to. Stream []string `json:"stream"` // The event type of the message // (update/delete/notification etc) Event string `json:"event"` // The actual payload of the message. In case of an // update or notification, this will be a JSON string. Payload string `json:"payload"` }
Message represents one streamed message.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents one open stream for a client.
func (*Stream) Close ¶ added in v0.14.0
func (s *Stream) Close()
Close will close the underlying context, finally removing it from the parent Streams per-account-map.
func (*Stream) Recv ¶ added in v0.14.0
Recv will block on receiving Message{}, returning early with a false value if provided context is canceled, or stream closed.
func (*Stream) Subscribe ¶ added in v0.14.0
Subscribe will add given type to given types this stream supports.
func (*Stream) Unsubscribe ¶ added in v0.14.0
Unsubscribe will remove given type (if found) from types this stream supports.
type Streams ¶ added in v0.14.0
type Streams struct {
// contains filtered or unexported fields
}
func (*Streams) Open ¶ added in v0.14.0
Open will open open a new Stream for given account ID and stream types, the given context will be passed to Stream.