A WikimediaStream connects to the Wikimedia Event Platform EventStreams domain (found at https://streams.wikimedia.org) and provides real-time recent changes and actions on Wikimedia wikis.

Hierarchy

  • EventEmitter
    • WikimediaStream

Constructors

Properties

_lastEventId: string

The last event ID received from the EventSource. Used to seamlessly re-listen to closed connections.

eventSource: EventSource

The EventSource which listens to streams on the Wikimedia Event Platform. Uses the eventsource package, which is backwards-compatible with the https://developer.mozilla.org/en-US/docs/Web/API/EventSource|EventSource Web API.

openCheckInterval: Timeout

A NodeJS.Timeout which checks if the EventSource is still open. The interval checks if the EventSource is still open every second, and reopens it if it's closed.

restartInterval: Timeout

A NodeJS.Timeout which reopens the EventSource every 15 minutes. This ensures that messages are still being received (with a worst possible lag of 15 minutes) even if the EventSource disconnects with no error or close event.

startingOptions: WikimediaStreamOptions
streams: ("eventgate-main.test.event" | "mediawiki.page-create" | "mediawiki.page-delete" | "mediawiki.page-links-change" | "mediawiki.page-move" | "mediawiki.page-properties-change" | "mediawiki.page-undelete" | "mediawiki.recentchange" | "mediawiki.revision-create" | "mediawiki.revision-tags-change" | "mediawiki.revision-visibility-change")[]

The streams that this WikimediaStream is currently listening/will listen to.

VERSION: "3.0.0" = '3.0.0'

The version of this package. Used for the default User-Agent header.

captureRejectionSymbol: typeof captureRejectionSymbol
captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

defaultMaxListeners: number
defaultUserAgent: string = WikimediaStream.genericUserAgent

The default user agent to be used by wikimedia-streams.

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

genericUserAgent: string = ...

The generic user agent to be used by wikimedia-streams when no default user agent is used or set.

Accessors

Methods

  • Returns number

  • Start listening to the stream.

    Parameters

    Returns Promise<void>

    A Promise that resolves once the stream is open.

  • Parameters

    • n: number

    Returns this

  • Returns a promise that resolves when the stream is closed.

    Returns Promise<void>

  • Checks if a given string is a valid SpecificWikimediaEventStream ID.

    Parameters

    Returns stream is "eventgate-main.test.event" | "mediawiki.page-create" | "mediawiki.page-delete" | "mediawiki.page-links-change" | "mediawiki.page-move" | "mediawiki.page-properties-change" | "mediawiki.page-undelete" | "mediawiki.recentchange" | "mediawiki.revision-create" | "mediawiki.revision-tags-change" | "mediawiki.revision-visibility-change"

  • Checks if a given string is a valid WikimediaEventStream.

    Parameters

    • stream: string

      The string to check.

    Returns stream is "eventgate-main.test.event" | "mediawiki.page-create" | "mediawiki.page-delete" | "mediawiki.page-links-change" | "mediawiki.page-move" | "mediawiki.page-properties-change" | "mediawiki.page-undelete" | "mediawiki.recentchange" | "mediawiki.revision-create" | "mediawiki.revision-tags-change" | "mediawiki.revision-visibility-change"

    Whether the stream is a valid Wikimedia stream ID or not.

  • Checks if a given string is a valid AliasWikimediaEventStream ID.

    Parameters

    Returns stream is "page-create" | "page-delete" | "page-links-change" | "page-move" | "page-properties-change" | "page-undelete" | "recentchange" | "revision-create" | "test"

  • Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

    Deprecated

    since v4.0.0

  • Parameters

    • emitter: EventEmitter
    • event: string

    Returns AsyncIterableIterator<any>

  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string

    Returns Promise<any[]>

Generated using TypeDoc