Creates a new Wikimedia RecentChanges listener. This will automatically start the stream upon construction; you do not need to call WikimediaStream#open after instantiating this class.
The streams to listen to. You may choose any stream defined by the EventStreams documentation page.
Additional options for the EventSource.
Private
_lastThe last event ID received from the EventSource. Used to seamlessly re-listen to closed connections.
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.
Private
openA 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.
Private
restartA 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.
Private
Readonly
startingPrivate
Readonly
streamsThe streams that this WikimediaStream is currently listening/will listen to.
Static
Readonly
VERSIONThe version of this package. Used for the default User-Agent
header.
Static
Readonly
captureStatic
captureSets or gets the default captureRejection value for all emitters.
Static
defaultStatic
defaultThe default user agent to be used by wikimedia-streams.
Static
Readonly
errorThis 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.
Static
Readonly
genericThe generic user agent to be used by wikimedia-streams when no default user agent is used or set.
The current status of this stream.
Start listening to the stream.
Additional options for the EventSource.
A Promise that resolves once the stream is open.
Optional
event: "error" | "open" | "close" | WikimediaEventStreamStatic
isChecks if a given string is a valid SpecificWikimediaEventStream ID.
The string to check.
Static
isChecks if a given string is a valid WikimediaEventStream.
The string to check.
Whether the stream is a valid Wikimedia stream ID or not.
Static
isChecks if a given string is a valid AliasWikimediaEventStream ID.
The string to check.
Static
listenerStatic
onStatic
onceGenerated using TypeDoc
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.