diff --git a/lang/en_utf8/chat.php b/lang/en_utf8/chat.php
index 7eba9371b79..2c8e39c94bb 100644
--- a/lang/en_utf8/chat.php
+++ b/lang/en_utf8/chat.php
@@ -6,8 +6,9 @@ $string['chatname'] = 'Name of this chat room';
$string['chatreport'] = 'Chat sessions';
$string['chattime'] = 'Next chat time';
$string['configmethod'] = 'The normal chat method involves the clients regularly contacting the server for updates. It requires no configuration and works everywhere, but it can create a large load on the server with many chatters. Using a server daemon requires shell access to Unix, but it results in a fast scalable chat environment.';
+$string['confignormalupdatemode'] = 'Chatroom updates are normally served efficiently using the Keep-Alive feature of HTTP 1.1, but this is still quite heavy on the server. A more advanced method is to use the Stream strategy to feed updates to the users. Using Stream scales much better (similar to the chatd method) but may not be supported by your server.';
$string['configoldping'] = 'What is the maximum time that may pass before we detect that a user has disconnected (in seconds)? This is just an upper limit, as usually disconnects are detected very quickly. Lower values will be more demanding on your server. If you are using the normal method, never set this lower than 2 * chat_refresh_room.';
-$string['configrefreshroom'] = 'How often should the chat room itself be refreshed? (in seconds). Setting this low will make the chat room seem quicker, but it may place a higher load on your web server when many people are chatting';
+$string['configrefreshroom'] = 'How often should the chat room itself be refreshed? (in seconds). Setting this low will make the chat room seem quicker, but it may place a higher load on your web server when many people are chatting. If you are using Stream updates, you can select higher refresh frequencies -- try with 2.';
$string['configrefreshuserlist'] = 'How often should the list of users be refreshed? (in seconds)';
$string['configserverhost'] = 'The hostname of the computer where the server daemon is';
$string['configserverip'] = 'The numerical IP address that matches the above hostname';
@@ -39,6 +40,8 @@ $string['neverdeletemessages'] = 'Never delete messages';
$string['nextsession'] = 'Next scheduled session';
$string['noguests'] = 'The chat is not open to guests';
$string['nomessages'] = 'No messages yet';
+$string['normalstream'] = 'Stream';
+$string['normalkeepalive'] = 'KeepAlive';
$string['noscheduledsession'] = 'No scheduled session';
$string['repeatdaily'] = 'At the same time every day';
$string['repeatnone'] = 'No repeats - publish the specified time only';
diff --git a/mod/chat/config.html b/mod/chat/config.html
index 8baa10b1853..8d262c10f76 100644
--- a/mod/chat/config.html
+++ b/mod/chat/config.html
@@ -61,6 +61,21 @@
+
+
chat_normal_updatemode:
+
+chat_normal_updatemode, "", "", "");
+?>
+
+
+
+
+
+
diff --git a/mod/chat/gui_header_js/index.php b/mod/chat/gui_header_js/index.php
index f59e0d93450..6e0227acefa 100644
--- a/mod/chat/gui_header_js/index.php
+++ b/mod/chat/gui_header_js/index.php
@@ -52,6 +52,11 @@
$params = "chat_sid=$chat_sid";
+ // fallback to the old jsupdate, but allow other update modes
+ $updatemode = 'jsupdate';
+ if (!empty($CFG->chat_normal_updatemode)) {
+ $updatemode = $CFG->chat_normal_updatemode;
+ }
?>
@@ -65,7 +70,7 @@