Fix spelling typo in comments.
Support 'code' and 'reason' arguments of WebSocket.close
Copy CONNECTING, OPEN, CLOSING, CLOSED properties from WebSocket

This increases compatibility as a drop-in replacement.

eg:

    var SocketType = useReconnecting ? ReconnectingWebSocket : WebSocket;

    SocketType.CONNECTING
Document some API differences between WebSocket and ReconnectingWebSocket.

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
Remove some non-standard properties from the interface.

These are not present on WebSocket. They only shadow constructor arguments
so clients who need them can stash them on the object directly themselves.

Note:

- `protocols` is a list of protocols. WebSocket sets the `protocol`
  (singular) property to reflect the selected protocol.
- `URL` is a redundant duplicate of the `url` property.
Support the `protocol` property.
Document sections and reorder slightly to group.
Function onconnecting does not have an argument.
Move default event handlers to prototype.

Allows user to delete their handlers without causing exceptions later.
f Remove some non-standard properties
Add support for handling events via addEventListener.

This allows multiple listeners, for example.
Add API documentation.
Add TypeScript declaration for ReconnectingWebSocket class.