Package com.bybit.api.client.websocket
Class WebsocketClientImpl
- java.lang.Object
-
- com.bybit.api.client.websocket.WebsocketClientImpl
-
- All Implemented Interfaces:
WebsocketClient
public class WebsocketClientImpl extends Object implements WebsocketClient
-
-
Constructor Summary
Constructors Constructor Description WebsocketClientImpl(String apikey, String secret, String baseUrl, Integer pingInterval, String maxAliveTime, Boolean debugMode, String logOption, WebsocketMessageHandler messageHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()voidgetPrivateChannelStream(List<String> argNames, String path)voidgetPublicChannelStream(List<String> argNames, String path)Orderbook Subscribe to the orderbook stream.voidonClose(int code, String reason)voidonError(Throwable t)voidonMessage(String msg)voidonOpen(okhttp3.WebSocket ws)
-
-
-
Method Detail
-
onMessage
public void onMessage(String msg)
- Specified by:
onMessagein interfaceWebsocketClient
-
onError
public void onError(Throwable t)
- Specified by:
onErrorin interfaceWebsocketClient
-
onClose
public void onClose(int code, String reason)- Specified by:
onClosein interfaceWebsocketClient
-
onOpen
public void onOpen(okhttp3.WebSocket ws)
- Specified by:
onOpenin interfaceWebsocketClient
-
connect
public void connect()
- Specified by:
connectin interfaceWebsocketClient
-
getPublicChannelStream
public void getPublicChannelStream(List<String> argNames, String path)
Description copied from interface:WebsocketClientOrderbook Subscribe to the orderbook stream. Supports different depths. TIP Once you have subscribed successfully, you will receive a snapshot. The WebSocket will keep pushing delta messages every time the orderbook changes. If you receive a new snapshot message, you will have to reset your local orderbook. If there is a problem on Bybit's end, a snapshot will be re-sent, which is guaranteed to contain the latest data. INFO Linear and inverse level 1 data: if 3 seconds have elapsed without a change in the orderbook, a snapshot message will be pushed again. Linear and inverse: Level 1 data, push frequency: 10ms Level 50 data, push frequency: 20ms Level 200 data, push frequency: 100ms Level 500 data, push frequency: 100ms Spot: Level 1 data, push frequency: 10ms Level 50 data, push frequency: 20ms Level 200 data, push frequency: 200ms Option: Level 25 data, push frequency: 20ms Level 100 data, push frequency: 100ms Topic: orderbook.{depth}.{symbol} e.g., orderbook.1.BTCUSDT https://bybit-exchange.github.io/docs/v5/websocket/public/orderbook- Specified by:
getPublicChannelStreamin interfaceWebsocketClient
-
getPrivateChannelStream
public void getPrivateChannelStream(List<String> argNames, String path)
- Specified by:
getPrivateChannelStreamin interfaceWebsocketClient
-
-