# Change log for amqplib

## v2.4.3
- Complete a `close` that is waiting for the server's CloseOk when the connection ends first. Previously the promise returned by `channel.close()` or `connection.close()` never settled, and the callback of the callback API was never called, if the socket closed, the heartbeat timed out or the server closed the connection before the close was acknowledged. The same happened to `channel.close()` when `connection.close()` was called before the channel's CloseOk arrived, and a recovering connection could stop reconnecting when the connection it was closing after a failed `setup` was lost. The close now resolves (or calls back without an error) once the channel or connection has closed, however that came about. How the connection ended is reported as before, by the connection's `error` and `close` events
- Emit the channel `error` for a channel the client closed because of a fault, such as a delivery handler that threw, when the connection ends before the server acknowledges the close. Previously the error was dropped and the channel only emitted `close`
- Finish closing the connection when a channel callback or listener throws, or a channel `error` has no listener, while the connection is closing its channels. Previously the remaining channels could be left open, later callbacks on the same channel were never called and the connection might never emit `close`. Every channel is now closed and the connection emits `close`. **Upgrade note:** such a throw is emitted as an `error` on the connection just before its `close`, where it could previously be an uncaught exception
- Fail a `channel.get` whose message has not fully arrived when the channel or connection closes. Previously the promise never settled, and the callback of the callback API was never called, if the channel closed after the server's `BasicGetOk` but before the message content, because the `get` was no longer the channel's outstanding operation. The `get` now stays outstanding until its content has arrived, so it fails like any other interrupted operation, with the server's reason when the server closed the channel. A later operation queued on the same channel is now sent once the message is complete rather than while its content is still arriving
- Refuse an operation that a callback issues while its channel is closing. With the callback API, a callback given the error for an interrupted operation could issue another one, as a poll or retry loop does, and have it accepted and sent on the closed channel, where its own callback was never called. When the connection had been lost this could also raise an uncaught `stream.push() after EOF`. Such a call now throws `IllegalOperationError: Channel closed`, as any other call on a closed channel does (#878)

## v2.4.2
- Stop copying everything received of an incomplete frame each time more of it arrives. A frame that took many reads from the socket to arrive was copied in full on every one of them, so the work grew with the square of its size. The bytes waiting to be parsed are now kept in a buffer that doubles when it runs out of room, and each byte is copied fewer than three times however the frame arrives (GHSA-87x3-r7m4-7rm7, reported by Remi Testa ([@funkyremi](https://github.com/funkyremi)))

## v2.4.1
- Fix connection recovery when the connection is lost while the `setup` function is running. The new connection was only watched once setup had finished, so a socket error during setup crashed the process with an unhandled `error` event, and a close during setup left recovery holding the dead connection, never reconnecting, with every later `createChannel` failing. Such an attempt now counts as a failed connect: `connect-failed` is emitted and a reconnect is scheduled.
- Keep connection recovery working when a listener for one of its events throws. Previously a throwing `connect` listener closed the new connection and reconnected in an endless loop, a throwing `connect-failed` listener caused an unhandled rejection and ended recovery, and a throwing `disconnect` or `reconnect-scheduled` listener ended recovery without a reconnect. The throw is now delivered to a `handler-error` listener on the recovering connection, or raised as an uncaught exception when there is none, and recovery carries on either way
- Deliver a throw from a connection event listener to a `handler-error` listener registered on the connection, as documented. Previously the listener was only consulted for channels: on a connection returned by `connect` it was never called and the throw propagated into amqplib internals
- Stop delivering an `error` event that has no `error` listener to a `handler-error` listener. `handler-error` only reports throws from your own event listeners; an `error` event that nothing listens for on a connection or channel is now raised as it would be without a `handler-error` listener
- Close the underlying connection when `close` is called on a recovering connection while the `setup` function is running. Previously it was only closed once setup finished, and never if setup did not settle. **Upgrade note:** `close` now resolves (or calls back) once that connection has closed, and a setup function that is still running will see its connection closed
- Report a reconnect delay of 0 rather than `NaN` in `reconnect-scheduled` when `initialDelay` is 0 and the exponential backoff overflows
- Resolve a second `close` call on a recovering connection once the connection has closed, rather than immediately
- Use the default for a recovery `initialDelay`, `maxDelay`, `factor` or `jitter` option given as `null`. **Upgrade note:** `null` was previously read as 0 (1 for `factor`), so `initialDelay: null` reconnected without a delay; it now waits the default 100 ms. Pass 0 explicitly to reconnect immediately

## v2.4.0
- Decode a table that contains a key named `!`, and is the value of a header, argument or array element, as `{ '!': 'table', value: <the table> }`. Previously it was decoded as the bare table, which the encoder reads as an explicit type such as `{ '!': 'timestamp', value: 1 }`. Publishing headers that had been received with such a table therefore threw `Unknown type to encode`, or sent a different value without an error when the key held a valid type name. A received table can now also be told apart from a received timestamp or decimal. **Upgrade note:** a consumer that reads a table containing a `!` key must now read it from `value`. Tables without a `!` key, and a `!` key at the top level of the headers, are decoded as before
- Add `table` as an explicit type. `{ '!': 'table', value: { ... } }` is encoded as a table whose keys are taken literally, so it can contain a key named `!`

## v2.3.3
- Encode numbers below -2^63, `NaN`, `-Infinity` and fractions of 2^50 or more as doubles in headers and `arguments` tables. Previously `publish` threw a `RangeError` for these, including when the table had been received from the broker and was being published again. Numbers that could be encoded before are encoded as before
- Encode an explicit `timestamp` of 2^64, or an explicit `long` of 2^63, in a headers or `arguments` table as the largest value of that type, as versions before 2.0.1 did. The largest timestamp is decoded as 2^64, because 2^64 - 1 cannot be represented as a number, so since 2.0.1 a received table containing it could not be published again. Larger numbers still throw a `RangeError`
- Encode a message `timestamp` property of 2^64, or any other unsigned 64-bit method field of 2^64, as the largest value in the same way, so a message received with a timestamp of 2^64 - 1 can be published again (also a regression in 2.0.1)

## v2.3.2
- Encode and decode nested field tables and arrays without recursion. Previously a table nested a few thousand levels deep, which RabbitMQ accepts and delivers, overflowed the call stack while a consumer decoded the message headers. The connection closed with `Maximum call stack size exceeded`, the message was requeued, and each reconnecting consumer failed the same way. There is no depth limit, and everything that encoded or decoded before produces the same result (GHSA-gfjv-mq5g-xjfw, reported by Dickson Wu ([@DicksonWu654](https://github.com/DicksonWu654)))
- Decode a field table key named `__proto__` as an ordinary property. Previously it replaced the decoded table's prototype: a table value was inherited from, a null value removed the prototype, and any other value was dropped. With a byte array value followed by a numeric key, decoding threw a `TypeError` and closed the connection in the same way. **Upgrade note:** headers received with a `__proto__` key now have it as an own property (GHSA-gfjv-mq5g-xjfw)

## v2.3.1
- Throw a clear `RangeError` from `publish` when an encoded headers or `arguments` table exceeds the 64 KiB encoding buffer. Previously the outcome depended on where the boundary fell: a string or Buffer value crossing the end of the buffer was silently truncated, producing a frame whose table length prefix did not match its contents, which RabbitMQ rejected by closing the connection with a 541 `INTERNAL_ERROR` after `publish` had returned; at other positions a bare `offset is out of range` error escaped from `publish` instead (fixes #867)

## v2.3.0
- Reject a `connection.tune` whose `frameMax` is below the protocol minimum of 4096 (the spec allows 0 or at least frame-min-size). Previously such a value was accepted, and the first publish whose encoded frames total 2048 bytes or more entered a loop in `sendContent` that never advanced, exhausting memory. `sendContent` now also throws if `frameMax` leaves no room for a body frame (GHSA-37f9-7m79-6866, reported by Rizwan Bedekar ([@r-bedekar](https://github.com/r-bedekar)); fix based in part on their patch and tests)
- Add a `maxFrameSize` connection option, also settable as a URL query parameter, bounding the payload size of frames accepted from the server. The default is 64 MiB, or the negotiated `frameMax` if that is larger, so raising `frameMax` needs no second option; `0` disables the limit. Incoming frame sizes were previously unchecked, so a frame header declaring up to 4 GiB made the client buffer, and repeatedly re-copy, that much data before looking at it. An oversized frame is now refused from its header alone and closes the connection with `Frame size N exceeds maxFrameSize M`. The limit is deliberately separate from the negotiated `frameMax`, since some brokers send larger frames without splitting them (see #784). **Upgrade note:** a broker that delivers an unsplit frame larger than the limit will now have that connection closed; pass `maxFrameSize: 0`, or a higher value, to restore the previous behaviour (GHSA-37f9-7m79-6866)

## v2.2.1
- Return the server acknowledgement from promise-based `channel.cancel`, matching the callback API (thanks [@edsonsims](https://github.com/edsonsims)).
- Type `cancel` replies as `Replies.Cancel` (`{ consumerTag }`) in both the promise and callback API declarations, which previously claimed `Replies.Empty`.
- Fix callback-based `waitForConfirms` never calling back when invoked after the confirm channel closed with unconfirmed messages; it now yields a `channel closed` error, matching the promise API (thanks [@youdie006](https://github.com/youdie006)).
- `waitForConfirms` (both APIs) now always fails with `channel closed` after the channel closes with unconfirmed messages. Previously it reported success if every outstanding message had its own callback, or on any call after the first.
- The callback API's `waitForConfirms` callback is now required in the TypeScript declarations, matching the docs. Calling it without one threw at runtime.
- Replace `.npmignore` with a `files` allowlist in `package.json` so the published package no longer includes tests, tooling config, dotfiles or the defs generator. Install size drops from 577 kB to 358 kB (fixes #859, thanks [@rubiesonthesky](https://github.com/rubiesonthesky))

## v2.2.0
- Add `calculateDelay` recovery option for supplying a custom reconnect delay strategy, e.g. full jitter, decorrelated jitter or a fixed schedule. When set, `maxDelay` is not applied to its return value; when it throws or returns an invalid value, recovery gives up as if `maxRetries` were exhausted (fixes #855, thanks [@GiHoon1123](https://github.com/GiHoon1123))
- The built-in reconnect delay no longer exceeds `maxDelay`. Previously the cap was applied before jitter, so delays could overshoot it by up to the jitter fraction. The exponential base is now capped at `maxDelay / (1 + jitter)` so the full jitter range fits under the cap; with default settings the steady-state delay is now spread over 20-30s rather than 24-36s
- Channel operations attempted after recovery has given up (`reconnect-failed`) now reject with the failure instead of waiting forever
- Add `initialMaxRetries` recovery option to bound retries before the first successful connection separately from `maxRetries`, so startup can fail fast while steady-state recovery retries indefinitely (fixes #856)

## v2.1.0
- Add `waitForConnect` recovery option. When `false`, `connect` returns the recovering connection immediately instead of waiting for the first successful connection, so listeners for `connect`, `connect-failed` and `reconnect-scheduled` can be attached before the initial attempt, and `close()` can cancel it. Expose `waitForConnect()` on recovering connections to await the first connection (fixes #858)
- Fix `setup` being run when `close()` is called while the initial connection attempt is in flight

## v2.0.1
- Remove `buffer-more-ints` dependency; use Node.js built-in BigInt Buffer methods (`readBigInt64BE`, `readBigUInt64BE`, `writeBigInt64BE`, `writeBigUInt64BE`) which have been available since Node.js v10.4

## v2.0.0
- **BREAKING**: `heartbeat: 0` now disables heartbeats, overriding any value suggested by the server. Previously, `0` was treated as "no preference" and the server's suggested value was used. If you are passing `heartbeat: 0` and want to preserve the old behaviour, omit the option or pass `null` instead (fixes #467)

## v1.2.0
- Add bundled TypeScript type definitions (fixes #843)

## v1.1.1
- Forward `handler-error` events from the underlying connection to the recovery wrapper, so listeners attached to `RecoveringPromiseModel`/`RecoveringCallbackModel` receive handler errors

## v1.1.0
- Add connection recovery via `connectWithRecoveryPromise` and `connectWithRecoveryCallback` — automatically reconnects on connection loss with configurable backoff delay, jitter, and retry limits (thanks [@ShiriNmi1520](https://github.com/ShiriNmi1520))

## v1.0.7
- Fix `update-secret-ok` event not being forwarded by `ChannelModel` and `CallbackModel` (fixes #849)
- Add `handler-error` event to connections and channels. If a user-supplied event handler (e.g. `connection.on('close', ...)`, `channel.on('error', ...)`, `channel.on('delivery', ...)` etc.) throws a synchronous error, amqplib will emit a `handler-error` event on the same emitter with the thrown error and the name of the event whose handler threw — provided a `handler-error` listener is registered. If no `handler-error` listener is registered, behaviour is unchanged from previous versions. Note: in previous versions, errors thrown in connection `close` event handlers were silently swallowed; errors thrown in channel event handlers (other than `delivery`/`return`) would kill the channel and possibly the connection (fixes #334).

## v1.0.6
- Fix channel.get() not invoking callback with error on channel close; previously only an error event was emitted (fixes #832). **Note:** if you use the callback API, ensure your channel.get() callbacks handle errors — they will now be invoked in error cases where previously they were not. If you use the promise API, the returned promise now rejects with a proper Error object (with .code, .classId and .methodId properties) rather than a raw close frame.

## v1.0.5
- Fix ConfirmChannel callbacks silently dropped on channel close when some publishes had no callback (fixes #191)

## v1.0.4
- Updated build to use RabbitMQ 4.2
- Fix memory leak in ConfirmChannel.publish when channel is already closed (fixes #842)
- Close connection immediately when close() is called while the connection is blocked (fixes #744)

## v1.0.3
- Fix AssertionError crash when backpressure occurs while draining newStreams in Mux (fixes #841)

## v1.0.2
- Replace url-parse with WHATWG URL API

## v1.0.1
- Fix TLS connection failure when connecting to an AMQPS broker using an IP address (IPv4 or IPv6) — setting servername to an IP is not permitted by TLS SNI and throws ERR_INVALID_ARG_VALUE in Node.js 25+

## v1.0.0
- **BREAKING**: Update minimum Node.js requirement to v18
- Introduce Biome formatter for consistent code formatting
- Add automated formatting via pre-commit hooks using Lefthook
- Format entire codebase with standardised formatting rules
- Add npm format script for manual code formatting
- Enable noUnusedFunctionParameters lint rule and fix all violations
- Enable noUnusedVariables lint rule and remove all unused variables from codebase
- Replace all var declarations with let/const for modern JavaScript standards
- Ensure parseInt calls use explicit radix parameter for clarity and reliability
- Fix precision loss in test data generators by using JavaScript safe integer limits
- Add block scoping to switch statement cases to prevent variable declaration issues
- Enforce const usage for variables that are never reassigned
- Add node: protocol prefix to Node.js builtin module imports for clarity
- Use modern exponentiation operator (**) instead of Math.pow()
- Replace string concatenation with modern template literals
- Remove redundant 'use strict' directives as modules are automatically in strict mode
- Refactor assignment-in-expression patterns to improve code clarity and readability
- Replace comma operators with individual statements for clearer, more readable code
- Split comma-separated variable declarations into individual statements for consistency
- Replace Object.prototype.hasOwnProperty() with safer Object.hasOwn() method
- Enforce strict equality checks (=== and !==) instead of loose equality (== and !=)
- Replace global isNaN with Number.isNaN for safer type checking
- Ensure no variable redeclarations exist to prevent shadowing issues
- Replace global isFinite with Number.isFinite for safer numeric validation
- Enable useArrowFunction lint rule to prefer arrow functions for cleaner syntax
- Enable noUselessCatch lint rule to prevent useless catch blocks that only rethrow errors
- Enable noArguments rule to enforce modern rest parameters instead of legacy arguments object
- Enable bracketSpacing formatting rule to add spaces inside object literals
- Migrate test suite from Mocha to Node.js built-in test runner

## v0.10.9
- Add support for IPv6 urls

## v0.10.8
- Updated README

## v0.10.7
- Remove bitsyntax dependency - See https://github.com/amqp-node/amqplib/pull/785. Thanks @ikenfin
- Stop checking if frame max is exceeded when parsing frames - See https://github.com/amqp-node/amqplib/pull/784. Thanks @ohroy

## v0.10.6
- Replace references to the old squaremo/amqp.name repo with ones to amqp-node/amqplib
- Use a frame_max of 131072 by default for RabbitMQ 4.1.0 compatibility

## Changes in v0.10.5

    git log v0.10.4..v0.10.5

- Removed readable stream - See https://github.com/amqp-node/amqplib/issues/729
- Added support for unsigned integers - See https://github.com/amqp-node/amqplib/pull/773
- Committed protocol definitions - See https://github.com/amqp-node/amqplib/commit/0a87ee480311633cff41e43350a90cb3c1221506

## Changes in v0.10.4

- Improve stream example as per https://github.com/amqp-node/amqplib/issues/722
- Added support for RabbitMQ's connection update-secret operation. See https://github.com/amqp-node/amqplib/issues/755

## Changes in v0.10.3

    git log v0.10.2..v0.10.3

- Use @acuminous/bitsyntax fork. See https://github.com/amqp-node/amqplib/issues/453

## Changes in v0.10.2

    git log v0.10.1..v0.10.2

- Use Buffer.allocUnsafe when sending messages to improve performance ([PR
  695](https://github.com/amqp-node/amqplib/pull/695), thank you
  @chkimes and @Uzlopak)

## Changes in v0.10.1

    git log v0.10.0..v0.10.1

 * Allow servername to be specified via socket options as discussed in
   [issue 697](https://github.com/squaremo/amqp.node/issues/697)

## Changes in v0.10.0

    git log v0.9.1..v0.10.0

 * Use Native promises ([PR
   689](https://github.com/amqp-node/amqplib/pull/689), thank you
   @mohd-akram and @kibertoad)

## Changes in v0.9.1

    git log v0.9.0..v0.9.1

 * Assorted readme changes
 * Use Array.prototype.push.apply instead of concat in Mux ([PR
   658](https://github.com/squaremo/amqp.node/pull/658), thank you
   @Uzlopak and @kibertoad)
 * Use Map instead of Object for BaseChannel.consumers ([PR
   660](https://github.com/squaremo/amqp.node/pull/660), thank you
   @Uzlopak)
 * Delete consumer callback after cancellation to free memory ([PR
   659](https://github.com/squaremo/amqp.node/pull/659), thank you
   @Uzlopak and @kibertoad)


## Changes in v0.9.0

    git log v0.8.0..v0.9.0

 * Update mocha and replace the deprecated istanbul with nyc ([PR
   681](https://github.com/squaremo/amqp.node/pull/681)
 * Update url-parse ([PR
   675](https://github.com/squaremo/amqp.node/pull/675), thank you
   @suhail-n and @kibertoad)
 * fix: done called twice on invalid options ([PR
   667](https://github.com/squaremo/amqp.node/pull/667), thank you
   @luddd3 and @kibertoad)
 * Close connection to server on connect errors ([PR
   647](https://github.com/squaremo/amqp.node/pull/647), thank you
   @luddd3 and @kibertoad)
 * Modernise channel_model.js ([PR
   635](https://github.com/squaremo/amqp.node/pull/635), thank you
   @kibertoad and @jimmywarting)
 * Bring package-lock.json up to date ([PR
   653](https://github.com/squaremo/amqp.node/pull/653)
 * Update url-parse ([PR
   652](https://github.com/squaremo/amqp.node/pull/652), thank you
   @giorgioatanasov and @buffolander)
 * Modernise channel_model.js ([PR
   651](https://github.com/squaremo/amqp.node/pull/651), thank you
   for the review @kibertoad)
 * Modernise bitset.js ([PR
   634](https://github.com/squaremo/amqp.node/pull/634), thank you
   @kibertoad and @jimmywarting)
 * :warning: Drop CI for node versions below 10 ([PR
   631](https://github.com/squaremo/amqp.node/pull/631), thank you
   for the review @kibertoad)
 * Replace safe-buffer dependency with native buffers ([PR
   628](https://github.com/squaremo/amqp.node/pull/628), thank you
   @kibertoad and @jimmywarting)

## Changes in v0.8.0

    git log v0.7.1..v0.8.0

 * :warning: Support for NodeJS prior to v10 is dropped :warning: ([PR
   615](https://github.com/squaremo/amqp.node/pull/615), thank you
   @xamgore and everyone who helped there)
 * Use hostname as TLS servername, to help with using servers behind
   load balancers ([PR
   567](https://github.com/squaremo/amqp.node/pull/567), thanks to
   @carlhoerberg and commenters)

## Changes in v0.7.1

    git log v0.7.0..v0.7.1

 * Update url-parse (and others) ([PR
   607](https://github.com/squaremo/amqp.node/pull/545), thanks
   @ThomasGawlitza)

## Changes in v0.7.0

    git log v0.6.0..v0.7.0

 * Extend support to Node.js v15
 * Fix use of stream.write in tests

## Changes in v0.6.0

    git log v0.5.6..v0.6.0

 * Extend support to Node.js v14

## Changes in v0.5.6

    git log v0.5.5..v0.5.6

 * Increase size of encoding space for message headers, to fit e.g.,
   JWT ([PR 545](https://github.com/squaremo/amqp.node/pull/545));
   thanks @twatson83
 * Switch to a non-deprecated UUID module ([PR
   528](https://github.com/squaremo/amqp.node/pull/528)); thanks to
   @StrayBird-ATSH
 * Fix a bug in multiplexing that caused an assertion to fail ([PR
   503](https://github.com/squaremo/amqp.node/pull/503)); thanks
   @johanneswuerbach

## Changes in v0.5.5

    git log v0.5.3..v0.5.5

**NB** this includes a minor but possibly breaking change: after [PR
498](https://github.com/squaremo/amqp.node/pull/498), all confirmation
promises still unresolved will be rejected when their associated
channel is closed.

 * Generate defs in `npm prepare` rather than `npm prepublish` so that
  e.g., amqplib can be installed via git ([part of PR
  498](https://github.com/squaremo/amqp.node/pull/498))
 * Reject all pending confirmations when the channel is closed ([PR
  498](https://github.com/squaremo/amqp.node/pull/498)); thanks
  @johanneswuerbach
 * Update supported NodeJS versions in package.json ([PR
   525](https://github.com/squaremo/amqp.node/pull/525)); thanks
   @tingwai

## (Deprecated v0.5.4)

This release was mistakenly published without the generated file
`./defs.js`. It has been deprecated in favour of v0.5.5.

## Changes in v0.5.3

    git log v0.5.2..v0.5.3

 * Bump bitsyntax to remove some `Buffer` misuse deprecation notices
 ([PR 480])(https://github.com/squaremo/amqp.node/pull/480)
 * Test on node 11.1
  ([PR 473])(https://github.com/squaremo/amqp.node/pull/464); thanks
  @kibertoad
 * Updated various dependencies
 * Support queue mode during assertQueue
   ([PR 464])(https://github.com/squaremo/amqp.node/pull/464); thanks
   @JoeTheFkingFrypan
 * Expose serverProperties in the connection object
   ([PR 452])(https://github.com/squaremo/amqp.node/pull/452); thanks
   @jfromaniello
 * Test on Node 10
   ([PR 454])(https://github.com/squaremo/amqp.node/pull/454); thanks
   @kibertoad
 * Support amqplain credentials
   ([PR 451])(https://github.com/squaremo/amqp.node/pull/451); thanks
   @jfromaniello
 * Decorate channel errors with methodId and classId
   ([PR 447])(https://github.com/squaremo/amqp.node/pull/447); thanks
   @MitMaro
 * Resolve issues caused by Node 10 `readable` changes
   ([PR 442])(https://github.com/squaremo/amqp.node/pull/442)
 * Bump uglify to 2.6.x and node to 9.1 due to nodejs/node#16781.
   ([PR 439])(https://github.com/squaremo/amqp.node/pull/439)
 * Updated README with more modern Buffer syntax
   ([PR 438](https://github.com/squaremo/amqp.node/pull/438); thanks
   @ravshansbox
 * Support overflow option to assert queue
   ([PR 436])(https://github.com/squaremo/amqp.node/pull/436); thanks
   to @honestserpent
 * Replace instances of keyword `await`
   ([PR 396])(https://github.com/squaremo/amqp.node/pull/396),
   as discussed in
   [issue 235](https://github.com/squaremo/amqp.node/issues/235)
 * Use 3rd party url for better decoding of username/password
   ([PR 395])(https://github.com/squaremo/amqp.node/pull/395),
   as discussed in
   [issue 385](https://github.com/squaremo/amqp.node/issues/385))

## Changes in v0.5.2

    git log v0.5.1..v0.5.2

 * Increase encoding buffer to accommodate large header values
   ([PR 367](https://github.com/squaremo/amqp.node/pull/367))
 * Bring code up to date with new Buffer interface
   ([PR 350](https://github.com/squaremo/amqp.node/pull/350))
 * Fix dangling connection problem
   ([PR 340](https://github.com/squaremo/amqp.node/pull/340))
 * Clear up URL credentials parsing
   ([PR 330](https://github.com/squaremo/amqp.node/pull/330))
 * Allow connection params to be suppied in object
   ([PR 304](https://github.com/squaremo/amqp.node/pull/304))
 * Support explicit numeric types in field tables (e.g., headers)
   ([PR 389](https://github.com/squaremo/amqp.node/pull/389), from a
   suggestion in
   [issue 358](https://github.com/squaremo/amqp.node/issues/358))

Thank you to all contributors, of PRs, issues and comments.

## Changes in v0.5.1

    git log v0.5.0..v0.5.1

 * Fix mistake in closeBecause
   ([PR 298](https://github.com/squaremo/amqp.node/pull/298); thanks
   to @lholznagel and others who reported the issue, and to @nfantone
   for the rapid fix)

## Changes in v0.5.0

    git log v0.4.2..v0.5.0

 * Port to use bluebird rather than when.js
   ([PR 295](https://github.com/squaremo/amqp.node/pull/295); thanks
   to @nfantone, and special mention to @myndzi for #158)
 * Fixed a problem with using `channel.get` in the callback model
   ([PR 283](https://github.com/squaremo/amqp.node/pull/283); good
   catch, @shanksauce)
 * Added an example that uses generators (thanks @rudijs)
 * Fixed a link in the comments relating to heartbeats (thanks
   @tapickell)

## Changes in v0.4.2

   git log v0.4.1..v0.4.2

 * Better documentation and examples
 * Replace uses of ES6 keyword 'await'

## Changes in v0.4.1

   git log v0.4.0..v0.4.1

 * Tested in Node.JS 0.8 through 4.2 and 5.5
 * Emit an error with the 'close' event if server-initiated

## Changes in v0.4.0

   git log v0.3.2..v0.4.0

 * Tested on Node.JS 0.8 through 4.0 (and intervening io.js releases)
 * Change meaning of 'b' fields in tables to match RabbitMQ (and AMQP
   specification)
 * Can now pass an object in place of connection URL
   ([PR 159](https://github.com/squaremo/amqp.node/pull/159); thanks
   to @ben-page)
 * Operator-initiated connection close no longer results in 'error'
   event
   ([issue 110](https://github.com/squaremo/amqp.node/issues/110))
 * Channel and Connection errors have now a `.code` field with the
   AMQP reply-code, which may help distinguish error cases
   ([PR 150](https://github.com/squaremo/amqp.node/pull/150); thanks
   to @hippich)
 * Connection.close will resolve to an error if the connection is
   already closed
   ([issue 181](https://github.com/squaremo/amqp.node/issues/181))
 * Connection establishment will resolve with an error if the
   TCP-level connection or the handshake times out
   ([PR 169](https://github.com/squaremo/amqp.node/pull/169); thanks
   to @zweifisch and @RoCat, who both submitted fixes)
 * Add the `maxPriority` option as an alias for the `'x-max-priority'`
   queue argument
   ([PR 180](https://github.com/squaremo/amqp.node/pull/180); thanks
   to @ebardes)

## Changes in v0.3.2 (since v0.3.1)

   git log v0.3.1..v0.3.2

 * Make the engine specification more flexible to admit io.js releases

## Changes in v0.3.1 (since v0.3.0)

   git log v0.3.0..v0.3.1

### Fixes

 * Fail in the right way when a channel cannot be allocated [issue
 129](https://github.com/squaremo/amqp.node/issues/129)
 * Make `waitForConfirms` work properly in callback API [PR
   116](https://github.com/squaremo/amqp.node/pull/116)

### Enhancements

 * Two new options while connecting:
   [timeout](https://github.com/squaremo/amqp.node/pull/118) and [keep
   alive](https://github.com/squaremo/amqp.node/pull/125) (thanks to
   @rexxars and @jcrugzz respectively)

## Changes in v0.3.0 (since v0.2.1)

   git log v0.2.1..v0.3.0

### Enhancements

 * Allow additional client properties to be set for a connection
   [Issue 98](https://github.com/squaremo/amqp.node/issues/98) and
   [PR 80](https://github.com/squaremo/amqp.node/pull/80)
 * New method in channel API to wait for all unconfirmed messages
   [Issue 89](https://github.com/squaremo/amqp.node/issues/89)
 * Now supports RabbitMQ's `EXTERNAL` authentication plugin
   [Issue 105](https://github.com/squaremo/amqp.node/issues/105)

## Changes in v0.2.1 (since v0.2.0)

### Fixes

 * Do tuning negotation properly [PR
   84](https://github.com/squaremo/amqp.node/pull/84)

## Changes in v0.2.0 (since v0.1.3)

    git log v0.1.3..v0.2.0

### Fixes

 * Correctly deal with missing fields (issue 48)

### Enhancements

 * Added a callback-oriented API, parallel to the existing,
   promise-oriented API.
 * The response to assertExchange now contains the exchange name,
   analagous to assertQueue (issue 49)
 * The channel method `prefetch` now has a global flag, to be
   [compatible with newer RabbitMQ][rabbitmq-prefetch-global].

## Changes in v0.1.3 (since v0.1.2)

    git log v0.1.2..v0.1.3

### Enhancements

 * Add support in the API for using Basic.Reject rather than
   Basic.Nack, the latter of which is a RabbitMQ extension and not in
   older versions of RabbitMQ.

## Changes in v0.1.2 (since v0.1.1)

    git log v0.1.1..v0.1.2

### Fixes

 * Restore support for publishing zero-length messages

### Enhancements

 * Recognise [authentication failures][rabbitmq-auth-failure]
 * An option to set TCP_NODELAY on connection sockets

## Changes in v0.1.1 (since v0.1.0)

    git log v0.1.0..v0.1.1

### Fixes

 * Safer frame construction, no longer relies on allocating a large,
   fixed-size buffer and hoping it's big enough
 * The ports of RabbitMQ tutorials now avoid a race between publishing
   and closing the connection

### Enhancements

 * Support for RabbitMQ's consumer priority extension
 * Support for RabbitMQ's connnection.blocked extension
 * Better write speed from batching frames for small messages
 * Other minor efficiency gains in method encoding and decoding
 * Channel and connection state errors (e.g., trying to write when
   closed) include a stack trace from when they moved to that state
 * The `arguments` table, passed as an option to some methods, can
   include fields in its prototype chain
 * Provide the more accurately named `persistent` as a near equivalent
   of `deliveryMode`

## Changes in v0.1.0 (since v0.0.2)

    git log v0.0.2..v0.1.0

### Breaking changes

 * Consumer callbacks are invoked with `null` if the consumer is
   cancelled (see
   [RabbitMQ's consumer cancel notification][rabbitmq-consumer-cancel])
 * In confirm channels, instead of `#publish` and `#sendToQueue`
   returning promises, they return a boolean as for normal channels,
   and take a Node.JS-style `function (err, ok)` callback for the
   server ack or nack

### Fixes

 * Overlapping channel and connection close frames are dealt with
   gracefully
 * Exceptions thrown in consumer callbacks are raised as `'error'`
   events
 * Zero-size messages are handled
 * Avoid monkey-patching `Buffer`, and eschew
   `require('util')._extend`

### Enhancements

 * Channels now behave like `Writable` streams with regard to `#publish`
   and `#sendToQueue`, returning a boolean from those methods and
   emitting `'drain'`
 * Connections now multiplex frames from channels fairly
 * Low-level channel machinery is now fully callback-based


[rabbitmq-consumer-cancel]: http://www.rabbitmq.com/consumer-cancel.html
[rabbitmq-auth-failure]: http://www.rabbitmq.com/auth-notification.html
[rabbitmq-prefetch-global]: http://www.rabbitmq.com/consumer-prefetch.html
