1. Łukasz Fidosz
  2. gevent_cometd

Source

gevent_cometd / gevent_cometd / static / demo.html

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Chat demo</title>
<script
	src="http://ajax.googleapis.com/ajax/libs/dojo/1.6.1/dojo/dojo.xd.js"
	type="text/javascript"></script>
<script src="/static/client.js" type="text/javascript"></script>
</head>
<style type="text/css">
body{
    font-size: 10px;
    font-family: sans;
}
</style>
<body>
	<ul class="messages"></ul>
	
	
<form action="/message?secret=secret" id="msg_form" method="post">
<p>
Public channel<input type="radio" name="channel" value="pub_chan" checked="checked">
Alt. Public channel<input type="radio" name="channel" value="pub_chan2">
</p>
<p>
user <input type="text" name="user" value="User">
</p>
<p>
<textarea name="message" style="width:300px"></textarea>
</p>
<p>
<input type="submit" value="send message">
</p>
</form>

<script type="text/javascript">
    dojo.addOnLoad(function() {
        var form = dojo.byId("msg_form");
        dojo.connect(form, "onsubmit", function(event) {
            dojo.stopEvent(event);
            var req = dojo.formToObject(form);
            var xhrArgs = {
                url : form.action,
                postData: dojo.toJson(req, true),
                handleAs : "text",
                load : function(data) {
                },
                error : function(error) {
                    console.log(error);
                }
            }
            dojo.query('textarea[name=message]')[0].value = '';
            var deferred = dojo.xhrPost(xhrArgs);
        });
    });
</script>
	
</body>
</html>