diff --git a/src/createClientStream.js b/src/createClientStream.js index 72dce01..5da8e8e 100644 --- a/src/createClientStream.js +++ b/src/createClientStream.js @@ -8,7 +8,6 @@ module.exports=createClientStream; function createClientStream(options) { assert.ok(options, "options is required"); var stream = options.stream; - assert.ok(stream, "stream is required"); assert.ok(options.username, "username is required"); var keepAlive = options.keepAlive == null ? true : options.keepAlive; @@ -32,7 +31,7 @@ function createClientStream(options) { client.on("set_compression", onCompressionRequest); client.username = options.username; - client.setSocket(stream); + if (stream) client.setSocket(stream); var timeout = null; return client;