API:Recent changes stream

A core MediaWiki feature is that all changes to pages are visible: you can see who made what change to a page. On an active wiki, the overall pattern of activity is as interesting as the specific changes to pages: you can see spikes in overall activity, sudden interest in particular pages in response to news events, when editors are active, etc.

On MediaWiki wikis, the page Special:RecentChanges lists these changes. So you could reload this page and scan it to look for patterns. But there's a better way.

stream.wikimedia.org broadcasts all changes to all public wikis run by Wikimedia Foundation to clients over HTTP via EventStreams.

How it works on Wikimedia wikis
For years, the only recent changes feed was, which sent formatted IRC (Internet Relay Chat) messages to an IRC daemon on irc.wikimedia.org that broadcasted changes on various IRC channels.

In 2017, EventStreams was launched to expose arbitrary stream data over HTTP. This service replaces RCStream (described below). It uses the same to format RecentChanges, but also has the ability to resume from a older stream position, and also to expose more streams than just RecentChanges. Manual:RCFeed describes the properties of the change, which include the title of the page, the editor's comment about the change, the old and new revision IDs, the old and new length of the page, etc.

Explore the recent changes stream
"EventStreams" on Wikitech describes the API. See codepen.io/ottomata/pen/VKNyEw/ for a simple demo. It uses the EventSource library to connect with the stream and displays each change.

There are many implementations of EventSource clients. The EventStreams page shows an equivalent code samples in Python and NodeJS.

How it works in the MediaWiki code
When MediaWiki writes a change to the RecentChanges page, it also calls. The lets you configure different kinds of recent changes feeds, with different kinds of formatting. includes/rcfeed in core has their implementation. If you run a wiki of your own and would like to adapt these visualizations and monitors to it, you can enable similar feeds to a similar client that publishes changes over HTTP, WebSockets or on an IRC channel. As usual, all aspects of WMF's setup are free and open source.

Alternatives: request changes through the MediaWiki API
The regular MediaWiki API has various modules that report on changes. These use a "pull" model, you make an API request asking for changes rather than consuming a stream of changes "pushed" over HTTP, WebSockets or IRC.

feedrecentchanges action
This module provides changes to pages as an RSS feed. The  you specify (  or , both XML output) determines the format of the API response, overriding the   parameter

For more information, see Special:ApiHelp/feedcontributions.

recentchanges query module
You can use this to query for changes. It doesn't generate the same ← Older revision 	Revision as of some date output as feedrecentchanges, but it provides the revision IDs of page changes and can provide other information. To make a similar kind of request as the  example above, use a generator of. (Broken?)

For more information, see Special:ApiHelp/query+recentchanges.

Real-Time Recent Changes is a JavaScript tool that uses the  query module to monitor recent changes of a wiki in real-time.