Update WebSockets detection to the latest version

The previous detection code was for older, deprecated versions of WebSockets. The latest standard is unprefixed in all browsers(starts with version 11 for Firefox). The only exception is in Safari 5.1 which this patch walks around by checking the newly added "CLOSING" state.