API compatibility and documentation

Just started using this lib today Joe. Great stuff, thanks!

There were a few places where the API wasn't compatible with [WebSocket](https://developer.mozilla.org/en-US/docs/Web/API/WebSocket). This PR addresses some of them. For example, `addEventListener` and friends are supported.

Includes more API documentation and a TypeScript declaration file.

Tested in Chrome 38 and Firefox 33.