Real time events
- Moodle 1.9–5.1
- 更新 2026-10-02
Add real-time server-to-browser communication to your plugins via WebSockets or polling. Send notifications from PHP, receive events in JavaScript — no page reloads needed.
Real time events provides a framework for real-time communication between the server and the browser in Moodle plugins . It supports both server-to-client notifications and client-to-server messaging.
For example, when a teacher updates course content or starts a live quiz, all connected students instantly see the changes without refreshing the page, making the learning experience more interactive and engaging.
Features
Secure channel-based communication with hash authentication
Bidirectional messaging (server→client and client→server)
Guest user support (configurable)
Built-in test page for diagnostics and latency measurement
Pluggable backend architecture – ship your own or use the included PHP polling and Centrifugo backends
Backend plugins
Communication is handled by pluggable backends:
PHP polling (included) – works out of the box with no external dependencies. Events are stored in the database and delivered via long polling (configurable). No setup required.
Centrifugo (included) – uses the Centrifugo WebSocket server for low-latency, scalable real-time delivery. Includes an easy-to-deploy template.
For plugin developers
Adding real-time features to your plugin requires just a few lines of code. See the README for full documentation and code examples.
Tracker
This plugin was suggested and discussed in https://moodle.atlassian.net/browse/MDL-65795
- 2.1.2Moodle 4.5, 5.0, 5.1, 5.2, 5.3