package info.bitrich.xchangestream.gemini;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import info.bitrich.xchangestream.service.netty.JsonNettyStreamingService;
import org.knowm.xchange.currency.CurrencyPair;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;

/**
 * Created by Lukas Zaoralek on 15.11.17.
 */
public class GeminiProductStreamingService extends JsonNettyStreamingService {
    private static final Logger LOG = LoggerFactory.getLogger(GeminiProductStreamingService.class);

    private final CurrencyPair currencyPair;

    public GeminiProductStreamingService(String symbolUrl, CurrencyPair currencyPair) {
        super(symbolUrl, Integer.MAX_VALUE);
        this.currencyPair = currencyPair;
    }

    @Override
    public boolean processArrayMassageSeparately() {
        return false;
    }

    @Override
    protected String getChannelNameFromMessage(JsonNode message) throws IOException {
        return currencyPair.toString();
    }

    @Override
    public String getSubscribeMessage(String channelName, Object... args) throws IOException {
        return null;
    }

    @Override
    public String getUnsubscribeMessage(String channelName) throws IOException {
        return null;
    }
}

@@ -212,16 +212,129 @@
 ervice;%0A
+import io.netty.channel.ChannelHandlerContext;%0Aimport io.netty.handler.codec.http.websocketx.PingWebSocketFrame;%0A
 import o
@@ -373,16 +373,16 @@
 cyPair;%0A
-
 import o
@@ -866,16 +866,71 @@
 AX_VALUE
+, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_RETRY_DURATION,15
 );%0A     
@@ -1440,32 +1440,32 @@
 s IOException %7B%0A
-
         return n
@@ -1475,10 +1475,142 @@
 ;%0A    %7D%0A
+    @Override%0A    protected void handleIdle(ChannelHandlerContext ctx) %7B%0A        ctx.writeAndFlush(new PingWebSocketFrame());%0A    %7D%0A
 %7D%0A

Fix socket excessive close/reconnect