Skip to content

Commit

Permalink
Tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
ianbarber committed Feb 20, 2011
1 parent 8b87efc commit 4b63946
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
4 changes: 4 additions & 0 deletions chat/chat.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
$poll = new ZMQPoll();
$poll->add($sub, ZMQ::POLL_IN);
$readable = $writeable = array();
// Hack for chrome etc. to start polling
echo str_repeat("<span></span>", 100);
ob_flush();
flush();
while(true) {
$events = $poll->poll($readable, $writeable, 5000000);
if($events > 0) {
Expand Down
13 changes: 7 additions & 6 deletions chat/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<title>ZeroMQ Chat</title>
<style>
body {
padding: 20px;
padding: 5px;
background-color: #E5E5E5;
font-family: Verdana, Arial, Sans-Serif;
color: #555;
Expand All @@ -13,10 +13,10 @@
display: none;
}
#chatwindow {
width: 700px;
height: 400px;
width: 500px;
height: 50px;
overflow: scroll;
margin: 10px auto;
margin: 5px auto;
background: white;
border: 1px solid black;
}
Expand All @@ -26,12 +26,12 @@
}
#chatform {
width: 700px;
width: 500px;
margin: 0px auto;
}
#chatbox {
width: 620px;
width: 350px;
}
#datasrc {
Expand All @@ -44,6 +44,7 @@
<script lang="text/javascript">
function updateChat(response) {
$('#chatwindow').append('<p>' + response + '</p>');
$("#chatwindow").attr({ scrollTop: $("#chatwindow").attr("scrollHeight") });
}
$(document).ready(function(){
Expand Down
3 changes: 2 additions & 1 deletion chat/send.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@
$send->send("<em>" . $name . " has joined</em>");
} else {
$send->send($name . ': ' . $message);
}
}
exit();
4 changes: 2 additions & 2 deletions reqrep/req2.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
$req->connect("tcp://localhost:5454");

while(true) {
sleep($_SERVER['argv'][2]);
usleep($_SERVER['argv'][2]);
$req->send($_SERVER['argv'][1] . ": Hello");
echo $req->recv();
echo date("H:i:s ") . $req->recv();
echo PHP_EOL;
}

0 comments on commit 4b63946

Please sign in to comment.