Permalink
Browse files

move to streams2 interface

add basic test harness
expose close frame code and reason
  • Loading branch information...
1 parent 34e2d07 commit 36cf93bc9cea6909dbfc7211c29b86b2c5b384ea @jclulow jclulow committed Jun 7, 2013
Showing with 197 additions and 74 deletions.
  1. +6 −3 README.md
  2. +127 −71 lib/watershed.js
  3. +4 −0 package.json
  4. +31 −0 test/basic/client.js
  5. +29 −0 test/basic/server.js
View
@@ -92,9 +92,11 @@ and an `'end'` event will follow. The only argument will be an instance of
Emitted when the remote peer closes the connection without sending us a CLOSE
frame. An `'end'` event will follow.
-#### Event: 'end'
+#### Event: 'end' (code, reason)
-Emitted once when the socket is closing.
+Emitted once when the socket is closing. If we received a graceful CLOSE
+frame from the remote server, we will attempt to process it and pass `code`
+and `reason` -- both of type `String`.
#### Event: 'text'
@@ -126,7 +128,8 @@ TEXT frame is sent.
#### WatershedConnection.end(reason)
Closes the connection. The RFC allows a reason for closing the connection to
-be send in the CLOSE frame, though this is optional.
+be send in the CLOSE frame, though this is optional. If passed, `reason`
+should be a `String`.
#### WatershedConnection.destroy()
Oops, something went wrong.

0 comments on commit 36cf93b

Please sign in to comment.