Class CoinbaseProStreamingService
java.lang.Object
info.bitrich.xchangestream.service.ConnectableService
info.bitrich.xchangestream.service.netty.NettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
info.bitrich.xchangestream.service.netty.JsonNettyStreamingService
info.bitrich.xchangestream.coinbasepro.CoinbaseProStreamingService
-
Nested Class Summary
Nested classes/interfaces inherited from class info.bitrich.xchangestream.service.netty.NettyStreamingService
NettyStreamingService.NettyWebSocketClientHandler, NettyStreamingService.Subscription
-
Field Summary
Fields inherited from class info.bitrich.xchangestream.service.netty.JsonNettyStreamingService
objectMapper
Fields inherited from class info.bitrich.xchangestream.service.netty.NettyStreamingService
channels, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_IDLE_TIMEOUT, DEFAULT_RETRY_DURATION, uri
Fields inherited from class info.bitrich.xchangestream.service.ConnectableService
BEFORE_CONNECTION_HANDLER
-
Constructor Summary
ConstructorDescriptionCoinbaseProStreamingService
(String apiUrl, int maxFramePayloadLength, Duration connectionTimeout, Duration retryDuration, int idleTimeoutSeconds, Supplier<CoinbaseProWebsocketAuthData> authData, CoinbaseProOrderBookMode orderBookMode) CoinbaseProStreamingService
(String apiUrl, Supplier<CoinbaseProWebsocketAuthData> authData, CoinbaseProOrderBookMode orderBookMode) -
Method Summary
Modifier and TypeMethodDescriptionprotected String
getChannelNameFromMessage
(com.fasterxml.jackson.databind.JsonNode message) io.reactivex.rxjava3.core.Observable<CoinbaseProWebSocketTransaction>
getRawWebSocketTransactions
(CurrencyPair currencyPair, boolean filterChannelName) Subscribes to web socket transactions related to the specified currency, in their raw format.getSubscribeMessage
(String channelName, Object... args) getSubscriptionUniqueId
(String channelName, Object... args) getUnsubscribeMessage
(String channelName, Object... args) protected io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler
protected WebSocketClientHandler
getWebSocketClientHandler
(io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker handshaker, WebSocketClientHandler.WebSocketMessageHandler handler) protected void
handleChannelMessage
(String channel, com.fasterxml.jackson.databind.JsonNode message) void
setChannelInactiveHandler
(WebSocketClientHandler.WebSocketMessageHandler channelInactiveHandler) io.reactivex.rxjava3.core.Observable<com.fasterxml.jackson.databind.JsonNode>
subscribeChannel
(String channelName, Object... args) Subscribes to the provided channel name, maintains a cache of subscriptions, in order not to subscribe more than once to the same channel.void
subscribeMultipleCurrencyPairs
(ProductSubscription... products) Methods inherited from class info.bitrich.xchangestream.service.netty.JsonNettyStreamingService
messageHandler, processArrayMessageSeparately, sendObjectMessage
Methods inherited from class info.bitrich.xchangestream.service.netty.NettyStreamingService
disconnect, getChannel, getCustomHeaders, handleChannelError, handleError, handleIdle, handleMessage, isSocketOpen, openConnection, resubscribeChannels, sendMessage, setAcceptAllCertificates, setAutoReconnect, setEnableLoggingHandler, setLoggingHandlerLevel, setSocksProxyHost, setSocksProxyPort, subscribeConnectionState, subscribeConnectionSuccess, subscribeDisconnect, subscribeIdle, subscribeReconnectFailure, useCompressedMessages
Methods inherited from class info.bitrich.xchangestream.service.ConnectableService
connect, setBeforeConnectionHandler
-
Constructor Details
-
CoinbaseProStreamingService
public CoinbaseProStreamingService(String apiUrl, Supplier<CoinbaseProWebsocketAuthData> authData, CoinbaseProOrderBookMode orderBookMode) -
CoinbaseProStreamingService
public CoinbaseProStreamingService(String apiUrl, int maxFramePayloadLength, Duration connectionTimeout, Duration retryDuration, int idleTimeoutSeconds, Supplier<CoinbaseProWebsocketAuthData> authData, CoinbaseProOrderBookMode orderBookMode)
-
-
Method Details
-
getProduct
-
getSubscriptionUniqueId
- Overrides:
getSubscriptionUniqueId
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
-
subscribeChannel
public io.reactivex.rxjava3.core.Observable<com.fasterxml.jackson.databind.JsonNode> subscribeChannel(String channelName, Object... args) Subscribes to the provided channel name, maintains a cache of subscriptions, in order not to subscribe more than once to the same channel.- Overrides:
subscribeChannel
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
- Parameters:
channelName
- the name of the requested channel.- Returns:
- an Observable of json objects coming from the exchange.
-
getRawWebSocketTransactions
public io.reactivex.rxjava3.core.Observable<CoinbaseProWebSocketTransaction> getRawWebSocketTransactions(CurrencyPair currencyPair, boolean filterChannelName) Subscribes to web socket transactions related to the specified currency, in their raw format.- Parameters:
currencyPair
- The currency pair.- Returns:
- The stream.
-
getChannelNameFromMessage
- Specified by:
getChannelNameFromMessage
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
-
getSubscribeMessage
- Specified by:
getSubscribeMessage
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
- Throws:
IOException
-
getUnsubscribeMessage
- Specified by:
getUnsubscribeMessage
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
- Throws:
IOException
-
getWebSocketClientExtensionHandler
protected io.netty.handler.codec.http.websocketx.extensions.WebSocketClientExtensionHandler getWebSocketClientExtensionHandler()- Overrides:
getWebSocketClientExtensionHandler
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
-
getWebSocketClientHandler
protected WebSocketClientHandler getWebSocketClientHandler(io.netty.handler.codec.http.websocketx.WebSocketClientHandshaker handshaker, WebSocketClientHandler.WebSocketMessageHandler handler) - Overrides:
getWebSocketClientHandler
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
-
setChannelInactiveHandler
public void setChannelInactiveHandler(WebSocketClientHandler.WebSocketMessageHandler channelInactiveHandler) -
subscribeMultipleCurrencyPairs
-
handleChannelMessage
protected void handleChannelMessage(String channel, com.fasterxml.jackson.databind.JsonNode message) - Overrides:
handleChannelMessage
in classNettyStreamingService<com.fasterxml.jackson.databind.JsonNode>
-