lukeed / sockette

The cutest little WebSocket wrapper! 🧦
MIT License
2.45k stars 81 forks source link

How to get error code #55

Closed dssoma closed 5 years ago

dssoma commented 5 years ago

How to get error code while getting the error from the socket connection in onerror()?

lukeed commented 5 years ago

Hey, sorry for the delay – I was traveling~

The Sockette event listeners directly receive the native Events and Errors arguments. You should check ev.code – if anything is there at all.

You may want an additional listener on onclose too, since a code (numerical) will always exist there.

Hope that helps!