Permalink
Browse files

Tweaks

  • Loading branch information...
ianbarber committed Feb 20, 2011
1 parent 8b87efc commit 4b63946f64f318e185e387970cf8be43bb846b42
Showing with 15 additions and 9 deletions.
  1. +4 −0 chat/chat.php
  2. +7 −6 chat/index.php
  3. +2 −1 chat/send.php
  4. +2 −2 reqrep/req2.php
View
@@ -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) {
View
@@ -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;
@@ -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;
}
@@ -26,12 +26,12 @@
}
#chatform {
- width: 700px;
+ width: 500px;
margin: 0px auto;
}
#chatbox {
- width: 620px;
+ width: 350px;
}
#datasrc {
@@ -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(){
View
@@ -10,4 +10,5 @@
$send->send("<em>" . $name . " has joined</em>");
} else {
$send->send($name . ': ' . $message);
-}
+}
+exit();
View
@@ -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.