Comments (8)
Hi,
The API of Bitfinex is sometimes unstable and the driver needs a few connection attempts until a connection is established. According to the exception, you get the HTTP error 400 (Response code was not 101: 400
) back from Bitfinex. Please wait a few minutes and try it again.
Best Regards
Jan
from bitfinex-v2-wss-api-java.
Hello @jnidzwetzki,
Still does not work, but works with my custom websocket code sample.
from bitfinex-v2-wss-api-java.
Hi,
Up to now I have not been able to reproduce the problem. Could you post an example to reproduce the issue?
Best Regards
Jan
from bitfinex-v2-wss-api-java.
I have just used the example:
public static void main(String[] args) {
BitfinexApiBroker bitfinexApiBroker = new BitfinexApiBroker("xxx", "yyy");
try {
bitfinexApiBroker.connect();
} catch (APIException e) {
log.error("Could not connect to Bitfinex API", e);
}
}
and I get:
15:37:49.369 [main] DEBUG com.github.jnidzwetzki.bitfinex.v2.SequenceNumberAuditor - Resetting sequence auditor
15:37:49.378 [main] DEBUG com.github.jnidzwetzki.bitfinex.v2.SequenceNumberAuditor - Resetting sequence auditor
15:37:49.747 [main] ERROR test.BitfinexWebSocketClient2 - Could not connect to Bitfinex API
com.github.jnidzwetzki.bitfinex.v2.entity.APIException: javax.websocket.DeploymentException: Handshake error.
at com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker.connect(BitfinexApiBroker.java:330)
at test.BitfinexWebSocketClient2.main(BitfinexWebSocketClient2.java:75)
Caused by: javax.websocket.DeploymentException: Handshake error.
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:285)
at org.glassfish.tyrus.client.ClientManager.connectToServer(ClientManager.java:172)
at com.github.jnidzwetzki.bitfinex.v2.WebsocketClientEndpoint.connect(WebsocketClientEndpoint.java:87)
at com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker.connect(BitfinexApiBroker.java:321)
... 1 common frames omitted
Caused by: org.glassfish.tyrus.websockets.HandshakeException: Response code was not 101: 400
at org.glassfish.tyrus.websockets.HandShake.validateServerResponse(HandShake.java:314)
at org.glassfish.tyrus.websockets.draft06.HandShake06.validateServerResponse(HandShake06.java:98)
at org.glassfish.tyrus.container.grizzly.WebSocketFilter.handleClientHandShake(WebSocketFilter.java:368)
at org.glassfish.tyrus.container.grizzly.WebSocketFilter.handleHandshake(WebSocketFilter.java:353)
at org.glassfish.tyrus.container.grizzly.WebSocketFilter.handleRead(WebSocketFilter.java:274)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:837)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:748)
15:37:49.746 [Grizzly-worker(1)] INFO com.github.jnidzwetzki.bitfinex.v2.BitfinexApiBroker - Closing websocket: CloseReason[1000,Closing]
Process finished with exit code 0
from bitfinex-v2-wss-api-java.
Hi,
I'm sorry, but I was unable to reproduce the problem. Your test code works fine for me.
- Which Java version do you use?
- If you have a static IP address, could you try to connect from a different IP?
Best Regards
Jan
from bitfinex-v2-wss-api-java.
Hello,
-
I am using Java 8
-
I tried from a different IP, it didn't change a thing. In the meantime, I have developped my own bitfinex WS implementation, but I would be happy to help if I can.
from bitfinex-v2-wss-api-java.
Hello,
Could you try to add the following class to your project and execute it? Is this class able to establish a connection or do you see an exception?
import java.net.URI;
import javax.websocket.ClientEndpoint;
import javax.websocket.CloseReason;
import javax.websocket.ContainerProvider;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
import com.google.common.base.Throwables;
@ClientEndpoint
public class WebsocketTest {
public final static String BITFINEX_URI = "wss://api.bitfinex.com/ws/2";
public static void main(String[] args) throws Exception {
final WebsocketTest websocketTest = new WebsocketTest();
websocketTest.connect();
}
private void connect() throws Exception {
final WebSocketContainer container = ContainerProvider.getWebSocketContainer();
final URI bitfinexURI = new URI(BITFINEX_URI);
container.connectToServer(this, bitfinexURI);
Thread.sleep(100000);
}
@OnOpen
public void onOpen(final Session userSession) {
System.out.println("Websocket is now open");
}
@OnClose
public void onClose(final Session userSession, final CloseReason reason) {
System.out.println("Closing websocket: " + reason);
}
@OnMessage
public void onMessage(final String message) {
System.out.println("Got message: " + message);
}
@OnError
public void onError(final Session session, final Throwable t) {
System.out.println("OnError called:" + Throwables.getStackTraceAsString(t));
}
}
Best Regards
Jan
from bitfinex-v2-wss-api-java.
Because there is no activity in this issue for several days, I will close the ticket.
If you can reproduce the problem, you are welcome to re-open the ticket.
from bitfinex-v2-wss-api-java.
Related Issues (20)
- New release HOT 1
- spring boot application does not deploy on JBoss if I add bitfinex-v2-wss-api dependency to the pom file. (UT003024: Web socket deployment failed. java.lang.NoSuchMethodException: com.github.jnidzwetzki.bitfinex.v2.WebsocketClientEndpoint.<init>()) HOT 7
- Errors with derivatives HOT 1
- does not working walletTable HOT 2
- Does not work with currency symbols longer than 3 chars
- BitfinexCurrencyPair.registerDefaults() fails with error code 403 HOT 1
- ":" in pair name HOT 2
- Affiliate (referral) code support HOT 1
- PlaceOrder Error: cid: invalid HOT 7
- Reconnection hungs sometimes HOT 7
- Add leverage to derivative order HOT 1
- Subscription fails sometimes HOT 1
- Crypto currency codes more than 3 Characters HOT 6
- SimpleBitfinexApiBroker - OnError called java.lang.IllegalArgumentException: Unable to find order type for: INSUFFICIENT BALANCE (U1) was: PARTIALLY FILLED HOT 4
- Incorrect validation for possible values. The valid values are: 25 or 100 but should be 1, 25, 100, 250 HOT 1
- SimpleBitfinexApiBroker - OnError called java.lang.NullPointerException: Cannot invoke "String.equals(Object)" because "action" is null HOT 1
- Issue with currencies symbol more than 3 characters(ver:0.7.7 HOT 2
- price_oco_stop parameter missing in order manager. HOT 1
- Order flag issue HOT 2
- Test failed BitfinexCurrencyPairTest.registerDefaultsTestSplitting HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bitfinex-v2-wss-api-java.