diff --git a/src/index.js b/src/index.js index 3b40187..fa189fd 100644 --- a/src/index.js +++ b/src/index.js @@ -61,7 +61,7 @@ function WebSockets () { this.close = (callback) => { if (listeners.length === 0) { - throw new Error('there are no listeners') + callback(new Error('there are no listeners')) } var count = 0 listeners.forEach((listener) => {