postwait/node-amqp — pull request #295 by glenjamin (2014-01-20 19:19:49+00:00)
Title: Cleanly disconnect from the server with disconnect()

Sends connection.close, and waits for a connection.close-ok before
closing the socket.

connection.end() will still work for backwards compatibility by closing
the underlying socket, but is removed from the documentation.

I'm unsure whether I should have done more work around making sure to blackhole any messages received after sending the connection.close to properly follow the spec[1], or to shut down the object state of the channels and things.

As this is only new behaviour it should be perfectly safe to add regardless.

[1] https://www.rabbitmq.com/amqp-0-9-1-reference.html#connection.close