mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
930413b133
This is an alternative version of jsupdate.php that acts as a long-running daemon. It will feed/stall/feed JS updates to the client. From the module configuration select "Stream" updates. The client connection is not forever though. Once we reach CHAT_MAX_CLIENT_UPDATES (currently 1000), it will force the client to re-fetch it. This buys us all the benefits that chatd has, minus the setup, as we are using apache to do the daemon handling. Chat still defaults to the normal update method, which is now optimised to take advantage of keepalives -- so this change is safe. The instructions in the config page also indicate that this mode may not be well supported everywhere. It hasn't been tested on IIS for starters. In terms of relative cost -- if each hit on jsupdate.php incurs on ~20 db queries and delivers one update to the client, each hit on jsupdate takes ~20 queries, and then roughly 2~3 queries to serve each of the next 1000 updates. On busy sites, the difference is huge. There is still room for enhancements in both keepalive and stream update methods. I am pretty sure we can trim DB queries more.
130 lines
3.6 KiB
HTML
130 lines
3.6 KiB
HTML
<form method="post" action="module.php" name="form">
|
|
<input type="hidden" name="sesskey" value="<?php echo $USER->sesskey ?>">
|
|
|
|
<table cellpadding="9" cellspacing="0" >
|
|
|
|
<tr>
|
|
<td colspan="3" align="center">
|
|
<div><b><?php print_string('generalconfig', 'chat')?></b></div>
|
|
<div style="font-size: 0.8em;">(<?php print_string('explaingeneralconfig', 'chat')?>)</div>
|
|
</td>
|
|
</tr>
|
|
|
|
|
|
<tr valign="top">
|
|
<td align="right">chat_method:</td>
|
|
<td>
|
|
<?php
|
|
unset($options);
|
|
$options['header_js'] = get_string('methodnormal', 'chat');
|
|
$options['sockets'] = get_string('methoddaemon', 'chat');
|
|
choose_from_menu ($options, "chat_method", $CFG->chat_method, "", "", "");
|
|
?>
|
|
</td>
|
|
<td>
|
|
<?php print_string("configmethod", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td align="right">chat_refresh_userlist:</td>
|
|
<td>
|
|
<input name="chat_refresh_userlist" type="text" size="5" value="<?php p($CFG->chat_refresh_userlist) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configrefreshuserlist", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td align="right">chat_old_ping:</td>
|
|
<td>
|
|
<input name="chat_old_ping" type="text" size="5" value="<?php p($CFG->chat_old_ping) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configoldping", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="3" align="center"><hr />
|
|
<div><b><?php print_string('methodnormal', 'chat')?></b></div>
|
|
<div style="font-size: 0.8em;">(<?php print_string('explainmethodnormal', 'chat')?>)</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="right">chat_refresh_room:</td>
|
|
<td>
|
|
<input name="chat_refresh_room" type="text" size="5" value="<?php p($CFG->chat_refresh_room) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configrefreshroom", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="right">chat_normal_updatemode:</td>
|
|
<td>
|
|
<?php
|
|
unset($options);
|
|
$options['jsupdate'] = get_string('normalkeepalive', 'chat');
|
|
$options['jsupdated'] = get_string('normalstream', 'chat');
|
|
choose_from_menu ($options, "chat_normal_updatemode", $CFG->chat_normal_updatemode, "", "", "");
|
|
?>
|
|
</td>
|
|
<td>
|
|
<?php print_string("confignormalupdatemode", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="3" align="center"><hr />
|
|
<div><b><?php print_string('methoddaemon', 'chat')?></b></div>
|
|
<div style="font-size: 0.8em;">(<?php print_string('explainmethoddaemon', 'chat')?>)</div>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr valign="top">
|
|
<td align="right">chat_serverhost:</td>
|
|
<td>
|
|
<input name="chat_serverhost" type="text" size="20" value="<?php p($CFG->chat_serverhost) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configserverhost", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td align="right">chat_serverip:</td>
|
|
<td>
|
|
<input name="chat_serverip" type="text" size="16" value="<?php p($CFG->chat_serverip) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configserverip", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td align="right">chat_serverport:</td>
|
|
<td>
|
|
<input name="chat_serverport" type="text" size="5" value="<?php p($CFG->chat_serverport) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configserverport", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
<tr valign="top">
|
|
<td align="right">chat_servermax:</td>
|
|
<td>
|
|
<input name="chat_servermax" type="text" size="5" value="<?php p($CFG->chat_servermax) ?>" />
|
|
</td>
|
|
<td>
|
|
<?php print_string("configservermax", "chat") ?>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="3" align="center">
|
|
<input type="submit" value="<?php print_string("savechanges") ?>" /></td>
|
|
</tr>
|
|
</table>
|
|
|
|
</form>
|