org.webbitserver.handler.logging.LoggingEventSourceConnection Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of webbit Show documentation
Show all versions of webbit Show documentation
A Java event based WebSocket and HTTP server
package org.webbitserver.handler.logging;
import org.webbitserver.EventSourceConnection;
import org.webbitserver.netty.contrib.EventSourceMessage;
import org.webbitserver.wrapper.EventSourceConnectionWrapper;
class LoggingEventSourceConnection extends EventSourceConnectionWrapper {
private final LogSink logSink;
LoggingEventSourceConnection(LogSink logSink, EventSourceConnection connection) {
super(connection);
this.logSink = logSink;
}
@Override
public EventSourceConnectionWrapper send(String message) {
logSink.eventSourceOutboundData(this, message);
return super.send(message);
}
@Override
public EventSourceConnectionWrapper send(EventSourceMessage message) {
logSink.eventSourceOutboundData(this, message.build() + "\n");
return super.send(message);
}
}