Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

edited readme to show example

  • Loading branch information...
commit aa4815c22b9dd6d3d0b612eef93e8abbb29a42bb 1 parent 879c4c8
Bosky authored
Showing with 19 additions and 0 deletions.
  1. +19 −0 README.md
View
19 README.md
@@ -117,6 +117,25 @@ $(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(){
+ //passing url as a function that returns a url
+ //to connnect/reconnect to
+ var bullet = $.bullet(function(){
+ var url = 'ws://localhost/path/to/bullet/handler'
+ +'?time='+Date.now()
+ + '&ctr='+ctr;
+ return url;
+ });
+ bullet.onmessage = function(e){
+ ctr++;
+ };
+});
+```
+
The `$.bullet` function takes an optional second 'options' object.
The following properties are supported:
Please sign in to comment.
Something went wrong with that request. Please try again.