112 Commits
Author SHA1 Message Date
James Coglan cd53761699 Fix EventEmitter#listener_count in the case where the event type does not exist, and add EventEmitter#listners. 2013-08-04 12:11:37 +01:00
James Coglan ac3bb51cbd Adjust encoding operations so that encoding is explicit at the call site, and all strings written to I/O are ASCII-8BIT. 2013-07-02 09:46:29 +01:00
James Coglan ee5fe9ec5f Messages should be queued when the client is in the 'pre-connecting' state, as the client is initially. 2013-06-06 10:25:10 +01:00
James Coglan ae84f0eaf7 Headers#inspect should call @raw.inspect. 2013-05-12 15:12:44 +01:00
James Coglan 8cd6ff1dde Set status and headers as soon as they are known, so they are available in case of an error. 2013-05-12 14:49:59 +01:00
James Coglan be00c65ebd Make Headers#inspect do something useful. 2013-05-12 14:01:15 +01:00
James Coglan cfd2806683 Remove an unneeded instance variable. 2013-05-12 12:41:51 +01:00
James Coglan 3902b8bc4f Around here we use square brackets for arrays. 2013-05-11 23:03:17 +01:00
James Coglan 074a8a2f16 Add #status and #headers methods to the Client driver. 2013-05-11 20:42:06 +01:00
James Coglan 5a7fadbcbe Add API for setting custom handshake headers. 2013-05-11 20:28:36 +01:00
James Coglan 020c094e96 Add a driver for handling TCP servers, where we don't want to make the user parse the HTTP request. 2013-05-11 19:28:59 +01:00
James Coglan ba696e8e2c Implement a proper streaming HTTP response parser. This makes the client-side parser more robust and also gives a way to building a driver for TCP servers. 2013-05-11 16:56:29 +01:00
James Coglan 93dd655d6d Implement EventEmitter#on as a method that calls #add_listener instead of being an alias, so that overriding the latter affects the former. 2013-05-04 18:02:40 +01:00
James Coglan c9388b7627 Add a listener_count method to EventEmitter. 2013-05-04 18:00:17 +01:00
James Coglan c5526b1c09 Return false from websocket? unless the request method is GET. 2013-05-04 17:46:35 +01:00
James Coglan be1f1cdc35 Rename the module to websocket-driver. 2013-05-04 16:43:25 +01:00
James Coglan 9a28b3f90d Various bits of housekeeping. 2013-05-03 09:04:14 +01:00
James Coglan 86b3235e82 499 and 4999 are not the same number, James. 2013-05-02 01:25:12 +01:00
James Coglan f61a5e60f2 Add more robust error handling for Hybi and Client and emit error events when the protocol goes wrong. 2013-05-02 00:09:34 +01:00
James Coglan 7b0daf6f3c Implement the EventEmitter interface. 2013-04-30 08:53:33 +01:00
James Coglan 8855a0e720 Refer to the draft-76 request body as 'body' rather than 'head'. 2013-04-29 22:02:19 +01:00
James Coglan 8b975a0031 Return the protocol version from the Client handler. 2013-04-29 21:37:35 +01:00
James Coglan 38b19487c5 A few corrections I made while porting to Node. 2013-04-29 20:28:47 +01:00
James Coglan 2662d43b08 Some small refactorings I spotted while porting this to Node. 2013-04-29 00:14:45 +01:00
James Coglan 24d3e2ec85 Change the server() method to rack(). 2013-04-21 18:25:41 +02:00
James Coglan 10da09afbd Always emit the empty string instead of nil as the closure reason in Hybi. 2013-04-20 22:04:24 +01:00
James Coglan 787697dc59 Some more large renaming, this time putting everything inside the WebSocket::Protocol namespace. 2013-04-20 18:22:09 +01:00
James Coglan 948e6fb2e2 Switch to using event objects. 2013-04-20 15:17:21 +01:00
James Coglan eee225441e Empty the buffer once the whole handshake response has been received by the client, else HTTP headers are published as messages. 2013-04-20 14:56:44 +01:00
James Coglan 56dd161ee1 Add text() and binary() methods as sugar over frame(). 2013-04-20 13:59:16 +01:00
James Coglan 1be1a33eb1 Rename all of the things: Faye::WebSocket is now WebSocket::Protocol. 2013-04-20 13:00:25 +01:00
James Coglan 6c10dcf9b2 A big old refactoring with loads of new tests. API has been greatly simplified to remove knowledge of the protocol from the I/O adapter. 2013-04-20 12:17:08 +01:00
James Coglan 8cbcfa2026 Parser should actually use the options variable that's passed in. 2013-04-19 09:00:14 +01:00
James Coglan 87c934fd5a Make handshake_response private and provide a more abstrct start() method to tell the parser to begin responding. 2013-04-19 08:47:19 +01:00
James Coglan 18eb3e96f2 Refactor to reduce the coupling between the parser and the socket I/O object. 2013-04-15 09:05:52 +01:00
James Coglan 653cf4f5c7 Treat the Connection and Upgrade headers case-insensitively, and fail gracefully when they are absent. 2013-04-07 23:31:37 +01:00
James Coglan 30f9802c1c Make the hybi parser able to accept arrays of bytes for parsing. 2013-04-06 08:13:35 +01:00
James Coglan 0fa5ed8d48 Move root library file so it doesn't conflict with faye-websocket. 2013-04-06 07:10:10 +01:00
James Coglan d72fa37dbc Remove links to API specs. 2013-04-05 09:16:55 +01:00
James Coglan 6fd2c32b60 Strip the project down to just the parser classes. 2013-04-05 09:06:44 +01:00
James Coglan 2c9d2763d3 Make the Connection header case-insensitive. 2013-03-14 10:44:40 +00:00
James Coglan 799103fd47 Only supress headers if the response status is 101. 2013-02-13 23:40:01 +00:00
James Coglan 0b47e6eeab Single-quote string. (Yes, I'm a pedant.) 2013-02-10 23:48:06 +00:00
James Coglan 8f2e5c4295 If close() is called in the CONNECTING readyState, then close the TCP connection immediately without waiting for the handshake to complete. 2013-02-10 23:43:37 +00:00
James Coglan 41a1968ed6 Remove trailing whitespace. 2013-02-10 22:58:09 +00:00
James Coglan 5a9533a8ad Don't stop finalization from happening if close() is called while in the CLOSING state with no ack required. This means sudden interupts can get the socket cleaned up, say if it disconnects while waiting for a close-ack from the peer. See https://github.com/faye/faye-websocket-node/issues/19 for similar Node issue. 2013-02-10 22:45:53 +00:00
Gabe Bell ccf20579a8 support IE10's 'Websocket' type 2012-12-10 11:53:57 -05:00
Sean Grove 9cb89521ec Try to be more compliant with the http/1.1 spec 2012-05-21 19:44:59 +01:00
James Coglan 64ebb849b6 Add error code 1011. 2012-04-06 13:51:57 +01:00
James Coglan 1cb21521cd Use / as the default path if the client URI has no path. 2012-04-01 23:01:17 +01:00