BREAKING Make JS client throw if lastId not number

BREAKING Make JS client throw if lastId not number

diff --git a/CHANGELOG b/CHANGELOG
index 88e7fea..bb86617 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+- Unreleased
+
+  - BREAKING CHANGE: In the JavaScript client throw when when lastId is given but is not a number.
+
 09-06-2020
 
 - Version 3.3.1
diff --git a/README.md b/README.md
index 9cc5b5b..eae7b9f 100644
--- a/README.md
+++ b/README.md
@@ -304,6 +304,11 @@ MessageBus.subscribe("/channel", function(data){
 MessageBus.subscribe("/channel", function(data){
   // data shipped from server
 }, -3);
+
+// you will get the entire backlog
+MessageBus.subscribe("/channel", function(data){
+  // data shipped from server
+}, 0);
 `‍``
 
 #### JavaScript Client settings
diff --git a/assets/message-bus.js b/assets/message-bus.js
index 85a145d..f6662f6 100644
--- a/assets/message-bus.js
+++ b/assets/message-bus.js
@@ -484,13 +484,16 @@
     // -1 will subscribe to all new messages
     // -2 will recieve last message + all new messages
     // -3 will recieve last 2 messages + all new messages
+    // if undefined will default to -1
     subscribe: function(channel, func, lastId) {
       if (!started && !stopped) {
         me.start();
       }
 
-      if (typeof lastId !== "number") {
+      if (lastId === null || typeof lastId === "undefined") {
         lastId = -1;
+      } else if (typeof lastId !== "number") {
+        throw "lastId has type " + typeof lastId + " but a number was expected.";
       }
 
       if (typeof channel !== "string") {

GitHub sha: e309b6d5

This commit appears in #231 which was merged by SamSaffron.