Skip to content

Commit de72cc5

Browse files
author
ricci
committed
2.2.1 Improvements(Optimize ws url name and val)
1 parent b47247b commit de72cc5

12 files changed

Lines changed: 44 additions & 32 deletions

File tree

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,22 @@ Changelog
33
=========================
44

55

6+
### v2.2.1 Release
7+
#### Improvements
8+
- The domain name `wss://openapi-ws.bitmart.com` will not provide Futures 1.0 Websocket services.
9+
Please use the domain name wss://openapi-ws-v2.bitmart.com to access Futures 2.0 Websocket services
10+
- Rename `GlobalConst.CLOUD_WS_URL` to `GlobalConst.CLOUD_SPOT_WS_PUBLIC_URL`
11+
- Rename `GlobalConst.CLOUD_WS_PRIVATE_URL` to `GlobalConst.CLOUD_SPOT_WS_PRIVATE_URL`
12+
- Rename `GlobalConst.CLOUD_CONTRACT_WS_URL` to `GlobalConst.CLOUD_FUTURES_WS_PUBLIC_URL`
13+
and change the value from **wss://openapi-ws.bitmart.com/api?protocol=1.1** to **wss://openapi-ws-v2.bitmart.com/api?protocol=1.1**
14+
- Rename `GlobalConst.CLOUD_CONTRACT_WS_PRIVATE_URL` to `GlobalConst.CLOUD_FUTURES_WS_PRIVATE_URL`
15+
and change the value from **wss://openapi-ws.bitmart.com/user?protocol=1.1** to **wss://openapi-ws-v2.bitmart.com/user?protocol=1.1**
16+
- Upgrading dependencies with vulnerabilities
17+
- remove org.bouncycastle:bcprov-jdk15on:1.70
18+
19+
---
20+
21+
622
### v2.2.0 Release
723
#### New Features
824
- New

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ import com.bitmart.websocket.WebSocketCallBack;
144144
import com.google.common.collect.ImmutableList;
145145
import lombok.extern.slf4j.Slf4j;
146146

147-
import static com.bitmart.api.common.GlobalConst.CLOUD_WS_URL;
147+
import static com.bitmart.api.common.GlobalConst.CLOUD_SPOT_WS_PUBLIC_URL;
148148

149149
@Slf4j
150150
public class Ticker {
@@ -157,7 +157,7 @@ public class Ticker {
157157

158158
public static void main(String[] args) {
159159
try {
160-
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_WS_URL,
160+
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_SPOT_WS_PUBLIC_URL,
161161
new CloudKey(), new ReceiveMessage());
162162

163163
// Ticker Channel
@@ -201,7 +201,7 @@ public class BalanceChange {
201201

202202
public static void main(String[] args) {
203203
try {
204-
WebSocketClient webSocketClient = new WebSocketClient(GlobalConst.CLOUD_WS_PRIVATE_URL,
204+
WebSocketClient webSocketClient = new WebSocketClient(GlobalConst.CLOUD_SPOT_WS_PRIVATE_URL,
205205
new CloudKey(API_KEY, API_SECRET, API_MEMO), new ReceiveMessage());
206206

207207
// need login
@@ -322,7 +322,7 @@ import com.bitmart.websocket.contract.ActionParam;
322322
import com.google.common.collect.ImmutableList;
323323
import lombok.extern.slf4j.Slf4j;
324324

325-
import static com.bitmart.api.common.GlobalConst.CLOUD_CONTRACT_WS_URL;
325+
import static com.bitmart.api.common.GlobalConst.CLOUD_FUTURES_WS_PUBLIC_URL;
326326

327327
@Slf4j
328328
public class Ticker {
@@ -334,9 +334,10 @@ public class Ticker {
334334
}
335335

336336
}
337+
337338
public static void main(String[] args) {
338339
try {
339-
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_CONTRACT_WS_URL,
340+
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_FUTURES_WS_PUBLIC_URL,
340341
new CloudKey(), new ReceiveMessage());
341342

342343
// Ticker Channel
@@ -362,7 +363,7 @@ import com.bitmart.websocket.contract.ActionParam;
362363
import com.google.common.collect.ImmutableList;
363364
import lombok.extern.slf4j.Slf4j;
364365

365-
import static com.bitmart.api.common.GlobalConst.CLOUD_CONTRACT_WS_PRIVATE_URL;
366+
import static com.bitmart.api.common.GlobalConst.CLOUD_FUTURES_WS_PRIVATE_URL;
366367

367368
@Slf4j
368369
public class Assets {
@@ -378,9 +379,10 @@ public class Assets {
378379
}
379380

380381
}
382+
381383
public static void main(String[] args) {
382384
try {
383-
ContractWebSocket webSocketPrivateClient = new ContractWebSocket(CLOUD_CONTRACT_WS_PRIVATE_URL,
385+
ContractWebSocket webSocketPrivateClient = new ContractWebSocket(CLOUD_FUTURES_WS_PRIVATE_URL,
384386
new CloudKey(API_KEY, API_SECRET, API_MEMO), new ReceiveMessage());
385387

386388
// login

pom.xml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.github.bitmartexchange</groupId>
88
<artifactId>bitmart-java-sdk-api</artifactId>
9-
<version>2.2.0</version>
9+
<version>2.2.1</version>
1010
<packaging>jar</packaging>
1111
<name>${project.groupId}:${project.artifactId}</name>
1212
<description>A Java SDK specially used to call BitMart OpenAPI</description>
@@ -162,12 +162,6 @@
162162
<version>2.8.9</version>
163163
</dependency>
164164

165-
<!-- Bouncy Castle -->
166-
<dependency>
167-
<groupId>org.bouncycastle</groupId>
168-
<artifactId>bcprov-jdk15on</artifactId>
169-
<version>1.70</version>
170-
</dependency>
171165

172166
<!-- slf4j -->
173167
<dependency>

src/main/java/com/bitmart/api/Call.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public final class Call {
2121

2222
private final CloudContext cloudContext;
2323
private final OkHttpClient okHttpClient;
24-
private static final String USER_AGENT = "bitmart-java-sdk-api/2.2.0";
24+
private static final String USER_AGENT = "bitmart-java-sdk-api/2.2.1";
2525

2626
private static OkHttpClient createOkHttpClient(CloudContext cloudContext) {
2727
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();

src/main/java/com/bitmart/api/common/GlobalConst.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ public final class GlobalConst {
77
public static final String X_BM_SIGN = "X-BM-SIGN";
88
public static final String CLOUD_URL = "https://api-cloud.bitmart.com";
99
public static final String CLOUD_V2_URL = "https://api-cloud-v2.bitmart.com";
10-
public static final String CLOUD_WS_URL = "wss://ws-manager-compress.bitmart.com/api?protocol=1.1";
11-
public static final String CLOUD_WS_PRIVATE_URL = "wss://ws-manager-compress.bitmart.com/user?protocol=1.1";
12-
public static final String CLOUD_CONTRACT_WS_URL = "wss://openapi-ws.bitmart.com/api?protocol=1.1";
13-
public static final String CLOUD_CONTRACT_WS_PRIVATE_URL = "wss://openapi-ws.bitmart.com/user?protocol=1.1";
10+
public static final String CLOUD_SPOT_WS_PUBLIC_URL = "wss://ws-manager-compress.bitmart.com/api?protocol=1.1";
11+
public static final String CLOUD_SPOT_WS_PRIVATE_URL = "wss://ws-manager-compress.bitmart.com/user?protocol=1.1";
12+
public static final String CLOUD_FUTURES_WS_PUBLIC_URL = "wss://openapi-ws-v2.bitmart.com/api?protocol=1.1";
13+
public static final String CLOUD_FUTURES_WS_PRIVATE_URL = "wss://openapi-ws-v2.bitmart.com/user?protocol=1.1";
1414

1515
private GlobalConst() {
1616
throw new IllegalStateException("Utility class");

src/main/java/com/bitmart/websocket/WebSocketClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,12 @@ public class WebSocketClient {
5252
public WebSocketCallBack callBack;
5353

5454
public WebSocketClient(WebSocketCallBack callBack) throws CloudException {
55-
init(GlobalConst.CLOUD_WS_URL, null, callBack);
55+
init(GlobalConst.CLOUD_SPOT_WS_PUBLIC_URL, null, callBack);
5656
}
5757

5858

5959
public WebSocketClient(CloudKey cloudKey, WebSocketCallBack callBack) throws CloudException {
60-
init(GlobalConst.CLOUD_WS_URL, cloudKey, callBack);
60+
init(GlobalConst.CLOUD_SPOT_WS_PUBLIC_URL, cloudKey, callBack);
6161
}
6262

6363

src/test/java/com/bitmart/examples/futures/websocket/Assets.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.google.common.collect.ImmutableList;
99
import lombok.extern.slf4j.Slf4j;
1010

11-
import static com.bitmart.api.common.GlobalConst.CLOUD_CONTRACT_WS_PRIVATE_URL;
11+
import static com.bitmart.api.common.GlobalConst.CLOUD_FUTURES_WS_PRIVATE_URL;
1212

1313
@Slf4j
1414
public class Assets {
@@ -26,7 +26,7 @@ public void onMessage(String text) {
2626
}
2727
public static void main(String[] args) {
2828
try {
29-
ContractWebSocket webSocketPrivateClient = new ContractWebSocket(CLOUD_CONTRACT_WS_PRIVATE_URL,
29+
ContractWebSocket webSocketPrivateClient = new ContractWebSocket(CLOUD_FUTURES_WS_PRIVATE_URL,
3030
new CloudKey(API_KEY, API_SECRET, API_MEMO), new ReceiveMessage());
3131

3232
// login

src/test/java/com/bitmart/examples/futures/websocket/Ticker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.google.common.collect.ImmutableList;
99
import lombok.extern.slf4j.Slf4j;
1010

11-
import static com.bitmart.api.common.GlobalConst.CLOUD_CONTRACT_WS_URL;
11+
import static com.bitmart.api.common.GlobalConst.CLOUD_FUTURES_WS_PUBLIC_URL;
1212

1313
@Slf4j
1414
public class Ticker {
@@ -22,7 +22,7 @@ public void onMessage(String text) {
2222
}
2323
public static void main(String[] args) {
2424
try {
25-
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_CONTRACT_WS_URL,
25+
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_FUTURES_WS_PUBLIC_URL,
2626
new CloudKey(), new ReceiveMessage());
2727

2828
webSocketClient.send(new ActionParam().setAction("subscribe").setArgs(ImmutableList.of("futures/ticker")));

src/test/java/com/bitmart/examples/spot/websocket/BalanceChange.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void onMessage(String text) {
2727

2828
public static void main(String[] args) {
2929
try {
30-
WebSocketClient webSocketClient = new WebSocketClient(GlobalConst.CLOUD_WS_PRIVATE_URL,
30+
WebSocketClient webSocketClient = new WebSocketClient(GlobalConst.CLOUD_SPOT_WS_PRIVATE_URL,
3131
new CloudKey(API_KEY, API_SECRET, API_MEMO), new ReceiveMessage());
3232

3333
// need login

src/test/java/com/bitmart/examples/spot/websocket/Ticker.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import com.google.common.collect.ImmutableList;
99
import lombok.extern.slf4j.Slf4j;
1010

11-
import static com.bitmart.api.common.GlobalConst.CLOUD_WS_URL;
11+
import static com.bitmart.api.common.GlobalConst.CLOUD_SPOT_WS_PUBLIC_URL;
1212

1313
@Slf4j
1414
public class Ticker {
@@ -21,7 +21,7 @@ public void onMessage(String text) {
2121

2222
public static void main(String[] args) {
2323
try {
24-
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_WS_URL,
24+
ContractWebSocket webSocketClient = new ContractWebSocket(CLOUD_SPOT_WS_PUBLIC_URL,
2525
new CloudKey(), new ReceiveMessage());
2626

2727
webSocketClient.send(new OpParam().setOp("subscribe").setArgs(ImmutableList.of("spot/ticker:BTC_USDT")));

0 commit comments

Comments
 (0)