square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
https://square.github.io/okhttp/
Apache License 2.0
45.76k stars 9.15k forks source link

Websocket status code 1005 & 1006 #2696

Closed b4stien closed 8 years ago

b4stien commented 8 years ago

As per RFC 6455, status code 1005 or 1006 should be used when the websocket abnormally closed (ref: https://tools.ietf.org/html/rfc6455#section-7.1.5 and https://tools.ietf.org/html/rfc6455#section-7.4.1).

1006 in particular would be handy to detect that the network (or the server on the other side) crashed.

JakeWharton commented 8 years ago

Interesting. For both of these cases we trigger onFailure with the appropriate exception. I presume you're saying that we should instead be calling onClose on the listener and sending them in a close frame back to the server.

JakeWharton commented 8 years ago

The spec is pretty clear on this. Working on it.