b / kafka-websocket

Websocket server interface for Kafka distributed message broker
Other
345 stars 85 forks source link

Consumer Client Timeout #13

Open y2kbowen opened 9 years ago

y2kbowen commented 9 years ago

I have a Java client subscribing to a topic and the client has the socket closed after 5 minutes. I was expecting my client to have a persistent connection until it ended the session (maybe this is not the intended use for consumer?)The jetty socket default is that time. The service log shows

[DEBUG] 2015-05-21 13:43:50,319 org.eclipse.jetty.io.IdleTimeout checkIdleTimeout - SelectChannelEndPoint@7915e83{/192.168.80.1:63140<->7080,Open,in,out,R,-,300000,WebSocketServerConnection}{io=1,kio=1,kro=1} idle timeout check, elapsed: 300001 ms, remaining: -1 ms
[DEBUG] 2015-05-21 13:43:50,319 org.eclipse.jetty.io.IdleTimeout checkIdleTimeout - SelectChannelEndPoint@7915e83{/192.168.80.1:63140<->7080,Open,in,out,R,-,300000,WebSocketServerConnection}{io=1,kio=1,kro=1} idle timeout expired

I tried adding connector.setIdleTimeout(-1) to KafkaWebsocketServer.java but that did not change the result. The code I added looks like this:

    public void run() {
    try {
        Server server = new Server();
        ServerConnector connector = new ServerConnector(server);
        connector.setPort(Integer.parseInt(wsProps.getProperty("ws.port", DEFAULT_PORT)));
        connector.setIdleTimeout(-1);

Maybe the version of Jetty does not support infinite? I did find this article and the code shows a slightly different way of setting the server timeout but the comment at the bottom indicates what I did as the best result.

MrPl0p commented 5 years ago

Any solution found for this issue ?