Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;

import java.io.EOFException;
import java.net.URI;
import java.security.KeyStore;
import java.util.concurrent.ExecutorService;
Expand Down Expand Up @@ -130,8 +131,12 @@ public void close() {

@Override
public void send(String msg) {
checkState(channel != null && channel.isActive(), "channel not connected for sending");
channel.writeAndFlush(new TextWebSocketFrame(msg));
checkState(channel != null, "Channel not initialized");
if (!channel.isActive()) {
eventHandler.onError(new EOFException("WebSocket channel became inactive"));
} else {
channel.writeAndFlush(new TextWebSocketFrame(msg));
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,8 @@ public void run() {

@Override
public void onError(final Throwable e) {
if (e.getCause() != null && e.getCause() instanceof EOFException) {
logger.error("WebSocket reached EOF", e);
if (e instanceof EOFException || e.getCause() instanceof EOFException) {
logger.debug("WebSocket reached EOF", e);
} else {
logger.error("WebSocket error", e);
}
Expand Down