{"_id":"watershed","_rev":"48-961c0658b6f275725345f889d0b18128","name":"watershed","dist-tags":{"latest":"0.4.1"},"versions":{"0.0.1":{"name":"watershed","version":"0.0.1","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.0.1","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"}],"dist":{"shasum":"bc160d76afc945845f30c06f8cfc8a68924da94e","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.0.1.tgz","integrity":"sha512-saTiWnuHtdNzuKr6IuOvfGbAm084ta+OLsOqgNWwrdjVmJy2vQ36agO5oIqhTethSTF0TurzpRqjxv+ZEGopLg==","signatures":[{"sig":"MEUCIDVNYhnGGXiTEIZzDmpcI32VRtKjSCM9M8x0mPyh+2bZAiEA/P5Jo5ZmkzX+tonNUWWLVvicm1Zt5jbhDzvq+N4xltA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","_from":".","engines":["node >=0.8.0"],"_npmUser":{"name":"jclulow","email":"josh@sysmgr.org"},"repository":{"url":"git://github.com/jclulow/node-watershed.git","type":"git"},"_npmVersion":"1.2.2","description":"simple websockets (RFC6455) client and server","directories":{}},"0.1.0":{"name":"watershed","version":"0.1.0","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.1.0","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"}],"dist":{"shasum":"05908227c93d3eaa214df4bc86a9f11a97b21c5b","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.1.0.tgz","integrity":"sha512-JFYBx/aoM7HHRJkeOY8+QAfOU9wLsDsrZXgQ4hm7squCPu/dYy3FHXSIQd0oNbL0Wx/JqorJb3bklqeXrlT0kQ==","signatures":[{"sig":"MEUCIQCExJGhGdgGujiMe6MGlwam5o5slpMgYjsN+l0r6WpXsAIgXAvTxV2FC7cUGiNBaAKmanuec6LOYF1u5BsN63FdgCU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","_from":".","engines":["node >=0.8.0"],"_npmUser":{"name":"jclulow","email":"josh@sysmgr.org"},"repository":{"url":"git://github.com/jclulow/node-watershed.git","type":"git"},"_npmVersion":"1.2.2","description":"simple websockets (RFC6455) client and server","directories":{}},"0.2.0":{"name":"watershed","version":"0.2.0","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.2.0","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"}],"dist":{"shasum":"e1cc5e264a0b8a644bfb74d74f80956facbd7cec","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.2.0.tgz","integrity":"sha512-JER0Ms9dX+ltB0WpC3VuCqwNnPRLyVmXCJoXWYQaB4JzDqwpKpJ23AoqcxvjaPlbYpESbE0i+mjyVElbBkCFnA==","signatures":[{"sig":"MEQCIFSMo/voBg+VgBICpc3pnqby8weqj9HzOCCi2JcSdSb9AiBbRV2DP90TLdJjWDOOTGEjZU7R/NBGe+THDS0/uYwESg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","engines":["node >=0.8.0"],"repository":{"url":"git://github.com/jclulow/node-watershed.git","type":"git"},"description":"simple websockets (RFC6455) client and server","directories":{},"dependencies":{"readable-stream":"1.0.2"}},"0.3.0":{"name":"watershed","version":"0.3.0","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.3.0","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"}],"dist":{"shasum":"38c4995b3ccc9b1bef767a480054d1c7340578bb","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.3.0.tgz","integrity":"sha512-lbgjktAJK1/2h+35OkwbHmcvy082J9vFY2ztFSiBfg/4XOMKApjOhPnFhAbH/q5h973rcinK8mqpD9RJ/0KBxg==","signatures":[{"sig":"MEYCIQCiCOku7mwETpy1JxRUlQEVFHO1ZAgdEhjbVYYvpi4x7wIhALuceaynk1iTxvUl/Xe5Z81YcJdodbWFlD3qYED2RP64","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","engines":["node >=0.8.0"],"repository":{"url":"git://github.com/jclulow/node-watershed.git","type":"git"},"description":"simple websockets (RFC6455) client and server","directories":{},"dependencies":{"dtrace-provider":"0.2.8","readable-stream":"1.0.2"},"optionalDependencies":{"dtrace-provider":"0.2.8"}},"0.3.1":{"name":"watershed","version":"0.3.1","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.3.1","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"}],"homepage":"https://github.com/jclulow/node-watershed","bugs":{"url":"https://github.com/jclulow/node-watershed/issues"},"dist":{"shasum":"6dcede31f5272638bd4472266d47633edc7e0382","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.3.1.tgz","integrity":"sha512-RCMjDkMVKV5ozHaN17sde9hsNOq8bf9SSJFidK6SI0g0KSydFNVIVeUdLIFxtgyNw8VGcxjpLM5cWEyYF2/uUA==","signatures":[{"sig":"MEUCIQDT4Zl3k/gMfqBkw2PbVSoULXZIGFbrjmmanss+vetmewIgdEHIIPjx32JHyxHwQPdG4nyNKC6DTLdsibfFuacpQmY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","_from":".","_shasum":"6dcede31f5272638bd4472266d47633edc7e0382","engines":["node >=0.8.0"],"gitHead":"494c74d1a4ec8d99c8782bc26f73856112a8cc3d","scripts":{},"_npmUser":{"name":"jclulow","email":"josh@sysmgr.org"},"repository":{"url":"git://github.com/jclulow/node-watershed.git","type":"git"},"_npmVersion":"1.4.28","description":"simple websockets (RFC6455) client and server","directories":{},"dependencies":{"dtrace-provider":"0.6.0","readable-stream":"1.0.2"},"optionalDependencies":{"dtrace-provider":"0.6.0"}},"0.3.3":{"name":"watershed","version":"0.3.3","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.3.3","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"},{"name":"shmeeny","email":"richard.kiene@gmail.com"}],"homepage":"https://github.com/jclulow/node-watershed#readme","bugs":{"url":"https://github.com/jclulow/node-watershed/issues"},"dist":{"shasum":"ebfc2381cc246f61c7a50cc49ef57a1f028aad0f","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.3.3.tgz","integrity":"sha512-pBvRGfpP826FSS8/ekHqr+4B48jSSeM1EQ2B0Fl3IO18IiT4Owh+1GWP6jcrTlDcqwNfclDD11Zl6lt7EQArzQ==","signatures":[{"sig":"MEQCIG2JD8amOZNQoIQCL2PH1co/wK7S2k7TfoqtnxfLhF/NAiBUf7R36m1j3mnb+WKrz/NfxfttTs4AKQaOzJLXiaHnWQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","_from":".","_shasum":"ebfc2381cc246f61c7a50cc49ef57a1f028aad0f","engines":["node >=0.8.0"],"gitHead":"84d01ea350c5bd7ade083badf08c49fef46e125b","scripts":{},"_npmUser":{"name":"shmeeny","email":"richard.kiene@gmail.com"},"repository":{"url":"git://github.com/jclulow/node-watershed.git","type":"git"},"_npmVersion":"2.15.9","description":"simple websockets (RFC6455) client and server","directories":{},"_nodeVersion":"4.6.0","dependencies":{"dtrace-provider":"0.6.0","readable-stream":"1.0.2"},"optionalDependencies":{"dtrace-provider":"0.6.0"},"_npmOperationalInternal":{"tmp":"tmp/watershed-0.3.3.tgz_1477626488929_0.053544528083875775","host":"packages-12-west.internal.npmjs.com"}},"0.3.4":{"name":"watershed","version":"0.3.4","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.3.4","maintainers":[{"name":"jclulow","email":"josh@sysmgr.org"},{"name":"shmeeny","email":"richard.kiene@gmail.com"}],"homepage":"https://github.com/joyent/node-watershed#readme","bugs":{"url":"https://github.com/joyent/node-watershed/issues"},"dist":{"shasum":"79331f666366b3b1c6ab02ceb04bad8dd2eebb0c","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.3.4.tgz","integrity":"sha512-/lRBpLn2TvEwrIW5i35ZCpb+SIq4VWq4c1yxN311we+E4eXRW7EB5nybrv4fJEuBmgqyqVkT2gtQ6Zqu+u66mA==","signatures":[{"sig":"MEQCICaWx+ENdkD1TbcQDXusYa1JkCfbhAcHGfCjSJ5yGK2qAiA9YYHf6m/F3UVdm/kLE6ZUmRFZzySeTl5N5fMhXuwthQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","_from":".","_shasum":"79331f666366b3b1c6ab02ceb04bad8dd2eebb0c","engines":["node >=0.8.0"],"gitHead":"214d02f17ac35ab13de12e179e4a223c7251dba8","scripts":{},"_npmUser":{"name":"shmeeny","email":"richard.kiene@gmail.com"},"repository":{"url":"git://github.com/joyent/node-watershed.git","type":"git"},"_npmVersion":"2.15.11","description":"simple websockets (RFC6455) client and server","directories":{},"_nodeVersion":"4.6.2","dependencies":{"dtrace-provider":"~0.8","readable-stream":"1.0.2"},"devDependencies":{"tape":"^4.2.2","istanbul":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/watershed-0.3.4.tgz_1506011014282_0.17506547295488417","host":"s3://npm-registry-packages"}},"0.4.0":{"name":"watershed","version":"0.4.0","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.4.0","maintainers":[{"name":"arekinath","email":"alex@cooperi.net"},{"name":"shmeeny","email":"richard.kiene@gmail.com"},{"name":"jclulow","email":"josh@sysmgr.org"}],"homepage":"https://github.com/joyent/node-watershed#readme","bugs":{"url":"https://github.com/joyent/node-watershed/issues"},"dist":{"shasum":"e4124b877129b47652247767eb722029f8095531","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.4.0.tgz","integrity":"sha512-0t+IlJpw6spUvZd1fXKJvsQi2/fBRVY7HMl/f0HEpfPv6e8CKWhigHBYq8sLOranX9yNur1ywIf/5MZ8++ipJA==","signatures":[{"sig":"MEUCIQDP6iYjms4v3CrK2Srgf1HkhUtt62ooBUTQyCTWgpGSEgIgZnEnsQUpmRWGx4ftg3uOsIoL4rLx/4Gzs4AdaWrCxJg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"./lib/watershed.js","_from":".","_shasum":"e4124b877129b47652247767eb722029f8095531","engines":["node >=0.8.0"],"gitHead":"09e7e3cd5956efa9bebebeb3e8fcbcb3e5a4290a","scripts":{},"_npmUser":{"name":"arekinath","email":"alex@cooperi.net"},"repository":{"url":"git://github.com/joyent/node-watershed.git","type":"git"},"_npmVersion":"4.2.0","description":"simple websockets (RFC6455) client and server","directories":{},"_nodeVersion":"0.12.18","dependencies":{"dtrace-provider":"~0.8","readable-stream":"1.0.2"},"devDependencies":{"tape":"^4.2.2","istanbul":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/watershed-0.4.0.tgz_1511308406929_0.5286243334412575","host":"s3://npm-registry-packages"}},"0.4.1":{"name":"watershed","version":"0.4.1","author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"_id":"watershed@0.4.1","maintainers":[{"name":"todd.whiteman","email":"todd.whiteman@joyent.com"},{"name":"kusor","email":"kusorbox@gmail.com"},{"name":"wyatt","email":"wpreul@gmail.com"},{"name":"michael.hicks","email":"michael.hicks@joyent.com"},{"name":"bahamat","email":"bahamat@digitalelf.net"},{"name":"chudley","email":"aguycalledrichard@gmail.com"},{"name":"tchameroy","email":"tyler.chameroy@joyent.com"},{"name":"dbuell","email":"dayne.buell@joyent.com"},{"name":"jclulow","email":"josh@sysmgr.org"},{"name":"shmeeny","email":"richard.kiene@gmail.com"},{"name":"arekinath","email":"alex@cooperi.net"}],"homepage":"https://github.com/joyent/node-watershed#readme","bugs":{"url":"https://github.com/joyent/node-watershed/issues"},"dist":{"shasum":"79aa9cad9f9ac22f9979000bd1dbffb870dcf1bd","tarball":"https://registry.npmjs.org/watershed/-/watershed-0.4.1.tgz","fileCount":6,"integrity":"sha512-hzWQQ3O3R+q+V186tWVJYXfgGfMxv3dd/QhF29hlktn5A+dP4pMtjbtvDuyxFAnmoeweucM0MSgaaS432bthgQ==","signatures":[{"sig":"MEUCIEIdeJlr4ENO9ekTYmJ+jRJD4p3ztK7skfCXm7shpZtyAiEAiw8OUOftkhmrK0aWoOXsTkjwiL1tiZfJrRNwtNTkRBs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":28689,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh3A3HCRA9TVsSAnZWagAAvHkP/jIAu0NiRp1MKMSskUrD\ncPeQUEcv+e+2C+1vSK1zXyU+v09JQ8jEVa/U1ClBdORHJVMAhwQJorn7Vvfe\nUMvW9NvtbLnoeRh9vaB6tRKKbxtBDccA1oGmJKPGn7GC49C61gMExJGTjDpb\nARQ5ovOMCcufSRKgRMlaGHFNyZIOT3QK1Dpns0sp/7Suj84RD+syPwfTAtjb\nl+rA4B3X28wnbTG88nyZ7EpF9TQ6y0Uc4brqM86uS/vSmYrrsBdxgoqlljhE\nSPoIBFTS4xALxyz3bKrIqCx/j3mFHBVwbDXpOTppBINyuD3iQDbQh9GEu8dI\n214vGTjKFMJlFgm3Qd7FpNe+cdJlXYj+slvvW1gx9WMgfueMc6fap2CX8EuS\nBboMSwFq7oqOxXKpvy1Gg/mC79r3wOCN3El8iRwzm6u2u48IkKMx4Fqit6OY\nNaz8gP8s7ZGlKqIgKWyKW4vcYwpQlDgUknQG5BWciRI6AhW+61vQgu8+cFJt\nr19xDbYraaVNsUKNJc84bqtSrcFI2775JiMpr726SsTi99l3VX+VSRlQdBcu\n6nR47A8YUyqsYqsrb9oExYxa1KJncEdhAsgliFfbJd1u4db+pJ06aOa3CFf+\ne+pHMotvIpe5oSwK+AI0JX3hb0+WPcCN4SWkoCkp/sq4bNxqmJDf0qWnhiU6\nlD69\r\n=ixWo\r\n-----END PGP SIGNATURE-----\r\n"},"main":"./lib/watershed.js","engines":["node >=0.8.0"],"gitHead":"88e01e435a6e2ec9b3dc921d7269e507caad11c6","_npmUser":{"name":"bahamat","email":"bahamat@digitalelf.net"},"repository":{"url":"git+https://github.com/joyent/node-watershed.git","type":"git"},"_npmVersion":"6.14.13","description":"simple websockets (RFC6455) client and server","directories":{},"_nodeVersion":"12.22.7","dependencies":{"dtrace-provider":"~0.8","readable-stream":"1.0.2"},"_hasShrinkwrap":false,"devDependencies":{"tape":"^4.2.2","istanbul":"^0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/watershed_0.4.1_1635884817281_0.9069635041104287","host":"s3://npm-registry-packages"}}},"time":{"created":"2013-02-13T04:13:11.212Z","modified":"2025-11-26T18:16:13.302Z","0.0.1":"2013-02-13T04:13:11.882Z","0.1.0":"2013-05-14T00:35:32.342Z","0.2.0":"2013-06-08T00:35:55.564Z","0.3.0":"2013-06-10T02:07:33.913Z","0.3.1":"2015-10-26T17:55:53.590Z","0.3.3":"2016-10-28T03:48:09.155Z","0.3.4":"2017-09-21T16:23:34.414Z","0.4.0":"2017-11-21T23:53:27.108Z","0.4.1":"2021-11-02T20:26:57.431Z"},"bugs":{"url":"https://github.com/joyent/node-watershed/issues"},"author":{"name":"Joshua M. Clulow","email":"jmc@joyent.com"},"homepage":"https://github.com/joyent/node-watershed#readme","repository":{"url":"git+https://github.com/joyent/node-watershed.git","type":"git"},"description":"simple websockets (RFC6455) client and server","maintainers":[{"email":"todd.whiteman@joyent.com","name":"todd.whiteman"},{"email":"kusorbox@gmail.com","name":"kusor"},{"email":"michael.hicks@joyent.com","name":"michael.hicks"},{"email":"bahamat@digitalelf.net","name":"bahamat"},{"email":"Tr@visPaul.me","name":"tpaul"},{"email":"danmcd@edgecast.io","name":"kebesays"},{"email":"josh@sysmgr.org","name":"jclulow"},{"email":"npmjs.zero908@simplelogin.com","name":"shmeeny"},{"email":"alex@cooperi.net","name":"arekinath"}],"readme":"# node-watershed\n\nA simple implementation of WebSockets for use with node.js 'http'-style web\nserver or client.  Deals only with [RFC6455][1], ignoring any Browser-specific\npeculiarities, curiosities, and fallback mechanisms.\n\n## API\n\n### Watershed\n\nThe core of this library is a Factory-style class `Watershed`.  It has several\nstatic methods:\n\n#### Watershed.accept(http.ServerRequest, net.Socket, Buffer[, Boolean[, String[] ]])\n\nResponds to a client's request to Upgrade an HTTP connection to a WebSocket and\nreturns a `WatershedConnection`, which is also an `EventEmitter`.\n\nThe arguments to this method should ideally come from the `'upgrade'` event on\na node.js `http.Server`.  For example:\n\n```javascript\nvar shed = new Watershed();\nvar srv = http.createServer();\nsrv.listen(8080);\nsrv.on('upgrade', function(req, socket, head) {\n        var wsc;\n        try {\n                wsc = shed.accept(req, socket, head);\n        } catch (ex) {\n                console.error('error: ' + ex.message);\n                return socket.end();\n        }\n        wsc.on('text', function(text) {\n                console.log('received text: ' + text);\n        });\n        wsc.on('end', function() {\n                console.log('end!');\n        });\n        /* ... etc ... */\n});\n```\n\nThe additional penultimate boolean argument may be used when implementing a\nwebsocket-to-websocket proxy.  If set to `true`, then `accept()` returns the\nraw underlying `Socket` of the connection and does not construct a\n`WatershedConnection` instance.  No event handlers will be placed on the\nsocket, meaning you are free to continue using it directly (e.g. calling\n`pipe()` on it to join it to a backend socket).\n\nThe final list-of-strings argument can be optionally provided to allow for the\nuse of WebSocket subprotocol negotiation.  It is a list of case-sensitive\nstring names of supported subprotocols.  If given, and protocol negotiation\ntakes place, the chosen subprotocol can be found with the `getProtocol()`\nmethod.\n\n#### Watershed.generateKey()\n\nReturns a random, Base64-encoded 16-byte value suitable for use as the\n`Sec-WebSocket-Key` header on an Upgrade request.  See Example usage in\n`connect()`.\n\n#### Watershed.connect(http.ClientResponse, net.Socket, Buffer, String)\n\nAttaches a new client-side `WatershedConnection` to this presently Upgraded\nsocket.\n\nThe arguments to this method should ideally come from the `'upgrade'` event on\na node.js `http.Client`.  For example:\n\n```javascript\nvar shed = new Watershed();\nvar wskey = shed.generateKey();\nvar options = {\n    port: 8082,\n    hostname: '127.0.0.1',\n    headers: {\n        'connection': 'upgrade',\n        'upgrade': 'websocket',\n        'Sec-WebSocket-Key': wskey,\n        'Sec-WebSocket-Version': '13'\n    }\n};\nvar req = http.request(options);\nreq.end();\nreq.on('upgrade', function(res, socket, head) {\n        var wsc = shed.connect(res, socket, head, wskey);\n        wsc.send('Hi there!');\n        wsc.on('end', function() {\n                console.log('end!');\n        });\n        /* ... etc ... */\n});\n```\n\n### WatershedConnection\n\n#### Event: 'error'\n\nEmitted once when an error occurs during processing.  The socket will be closed\nand an `'end'` event will follow.  The only argument will be an instance of\n`Error`.\n\n#### Event: 'connectionReset'\n\nEmitted when the remote peer closes the connection without sending us a CLOSE\nframe.  An `'end'` event will follow.\n\n#### Event: 'end' (code, reason)\n\nEmitted once when the socket is closing.  If we received a graceful CLOSE\nframe from the remote server, we will attempt to process it and pass `code`\nand `reason` -- both of type `String`.\n\n#### Event: 'text'\n\nEmitted for each inbound TEXT frame.  The only argument will be a `String`\ncontaining the UTF-8 string payload.\n\n#### Event: 'binary'\n\nEmitted for each inbound BINARY frame.  The only argument will be a `Buffer`\ncontaining the binary payload.\n\n#### Event: 'ping'\n\nEmitted for each inbound PING frame.  The only argument will be a `Buffer`\ncontaining the nonce in the ping request.  Note that the library presently\nresponds with a PONG frame for each inbound PING frame.\n\n#### Event: 'pong'\n\nEmitted for each inbound PONG frame.  The only argument will be a `Buffer`\ncontaining the nonce in the pong response.\n\n#### WatershedConnection.getProtocol()\n\nReturns the negotiated subprotocol, if any, for this connection, as a String.\nIf no subprotocol negotiation took place, this method returns `null`.\n\n#### WatershedConnection.send(data)\n\nSends a frame through the socket.  The single argument `data` may be a\n`Buffer`, in which case a BINARY frame is sent; or a `String`, in which case a\nTEXT frame is sent.\n\n#### WatershedConnection.end(reason)\n\nCloses the connection.  The RFC allows a reason for closing the connection to\nbe send in the CLOSE frame, though this is optional.  If passed, `reason`\nshould be a `String`.\n\n#### WatershedConnection.destroy()\n\nImmediately destroy the underlying socket, without sending a CLOSE frame.  You\ngenerally want `end()`, rather than this, in order to perform RFC-compliant\nconnection shutdowns.\n\n## License\n\nMIT.\n\n[1]: http://tools.ietf.org/html/rfc6455\n","readmeFilename":"README.md"}