summaryrefslogtreecommitdiffstats
path: root/examples/clock
diff options
context:
space:
mode:
authorDave Peticolas <[email protected]>2013-06-09 13:44:03 -0700
committerDave Peticolas <[email protected]>2013-06-09 13:44:03 -0700
commitd4d541a4ea88b5483af2eae5c8e84649ac91c687 (patch)
tree3f346c6063371cf6e605e55604a4063cfd39311c /examples/clock
parent22ac46d2138a5cedf8cb6a7591a47bad1402f261 (diff)
downloadbullet-d4d541a4ea88b5483af2eae5c8e84649ac91c687.tar.gz
bullet-d4d541a4ea88b5483af2eae5c8e84649ac91c687.tar.bz2
bullet-d4d541a4ea88b5483af2eae5c8e84649ac91c687.zip
Distinguish different bullet connections in ping messages.
Diffstat (limited to 'examples/clock')
-rw-r--r--examples/clock/src/stream_handler.erl4
-rw-r--r--examples/clock/src/toppage_handler.erl2
2 files changed, 3 insertions, 3 deletions
diff --git a/examples/clock/src/stream_handler.erl b/examples/clock/src/stream_handler.erl
index 2f08342..72efa6f 100644
--- a/examples/clock/src/stream_handler.erl
+++ b/examples/clock/src/stream_handler.erl
@@ -15,8 +15,8 @@ init(_Transport, Req, _Opts, _Active) ->
TRef = erlang:send_after(?PERIOD, self(), refresh),
{ok, Req, TRef}.
-stream(<<"ping">>, Req, State) ->
- io:format("ping received~n"),
+stream(<<"ping: ", Name/binary>>, Req, State) ->
+ io:format("ping ~p received~n", [Name]),
{reply, <<"pong">>, Req, State};
stream(Data, Req, State) ->
io:format("stream received ~s~n", [Data]),
diff --git a/examples/clock/src/toppage_handler.erl b/examples/clock/src/toppage_handler.erl
index b9c6504..2b878be 100644
--- a/examples/clock/src/toppage_handler.erl
+++ b/examples/clock/src/toppage_handler.erl
@@ -51,7 +51,7 @@ $(document).ready(function(){
};
bullet.onheartbeat = function(){
console.log('ping: ' + name);
- bullet.send('ping');
+ bullet.send('ping: ' + name);
}
};