Permalink
Browse files

edited readme to show example

  • Loading branch information...
1 parent 879c4c8 commit 8a25b4996bd790f6b47e1d10126f7ee4574aa1d5 Bosky committed Oct 30, 2013
Showing with 17 additions and 0 deletions.
  1. +17 −0 README.md
View
@@ -117,6 +117,23 @@ $(document).ready(function(){
Always use the WebSocket (ws:) form for your bullet URLs and Bullet
will change the URL as needed for non-WebSocket transports.
+The URL can also be dynamic
+
+``` js
+var ctr=0;
+$(document).ready(function(){
+ var bullet = $.bullet(function(){
+ var url = 'ws://localhost/path/to/bullet/handler'
+ +'?time='+Date.now()
+ + '&ctr='+ctr;
+ return url;
+ });
+ bullet.onmessage = function(e){
+ lastCount ++;
+ };
+});
+```
+
The `$.bullet` function takes an optional second 'options' object.
The following properties are supported:

0 comments on commit 8a25b49

Please sign in to comment.