Four events, that is the whole API
The browser WebSocket exposes exactly four events: open, message, error, and close. You can wire them via on* properties (one handler each) or via addEventListener (multiple handlers, recommended). There is no connecting event, no reconnect event, no pong event — those are all things you build yourself.
Firing order
For a normal session: open → message* → close. For a failed handshake: error → close. For a runtime drop: ...message → error → close. Critically, error always fires before close, and error deliberately does not expose much — for security, the browser does not leak why the connection failed. To learn the close code and reason, look at the close event.
What you receive
event.data in message can be a string (text frames), a Blob (default for binary), or an ArrayBuffer (if you set ws.binaryType = 'arraybuffer'). event.code, event.reason, and event.wasClean on the close event tell you how it ended.