Skip to content

Commit 965f127

Browse files
OkHttp Failures are a combination of an Error *and* a Close.
We were only sending the Error, not the Close. Should fix #6. Closes #7.
1 parent 9983e9d commit 965f127

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/src/main/java/ua/naiksoftware/stomp/OkHttpConnectionProvider.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,10 @@ public void onClosed(WebSocket webSocket, int code, String reason) {
8080

8181
@Override
8282
public void onFailure(WebSocket webSocket, Throwable t, Response response) {
83+
// in OkHttp, a Failure is equivalent to a JWS-Error *and* a JWS-Close
8384
emitLifecycleEvent(new LifecycleEvent(LifecycleEvent.Type.ERROR, new Exception(t)));
85+
openedSocked = null;
86+
emitLifecycleEvent(new LifecycleEvent(LifecycleEvent.Type.CLOSED));
8487
}
8588

8689
@Override

0 commit comments

Comments
 (0)