From 148b6fe476e35e9e8db448d6dc73d57a3b23e800 Mon Sep 17 00:00:00 2001
From: Florent Gallaire
Date: Mon, 11 Nov 2013 02:16:50 +0100
Subject: [PATCH] DRY url.replace().
Automatically disable WebSocket when the URL begins with 'http'.
Update the README with the new 'http' url syntax.
Update the clock example with the new 'http' url syntax.
---
README.md | 5 ++++-
examples/clock/src/toppage_handler.erl | 17 +++++++++++------
priv/bullet.js | 19 +++++++++++++------
3 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/README.md b/README.md
index 8822c68..e8ab736 100644
--- a/README.md
+++ b/README.md
@@ -114,9 +114,12 @@ $(document).ready(function(){
});
```
-Always use the WebSocket (ws:) form for your bullet URLs and Bullet
+Use the WebSocket (ws:) form for your bullet URLs and Bullet
will change the URL as needed for non-WebSocket transports.
+Use the standard (http:) form for your bullet URLs and Bullet
+will only try non-WebSocket transports.
+
The `$.bullet` function takes an optional second 'options' object.
The following properties are supported:
diff --git a/examples/clock/src/toppage_handler.erl b/examples/clock/src/toppage_handler.erl
index 71512d3..be52be2 100644
--- a/examples/clock/src/toppage_handler.erl
+++ b/examples/clock/src/toppage_handler.erl
@@ -24,6 +24,10 @@ handle(Req, State) ->
Current time (best source): unknownunknown
+
+ Current time (best source non-websocket): unknown
+ unknown
+
Current time (websocket only): unknownunknown
@@ -44,10 +48,10 @@ handle(Req, State) ->