Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CometD client (BayeuxClient) state

See original GitHub issue

CometD: 7.0.6

java -version openjdk version “11.0.15” 2022-04-19 LTS OpenJDK Runtime Environment Zulu11.56+19-CA (build 11.0.15+10-LTS) OpenJDK 64-Bit Server VM Zulu11.56+19-CA (build 11.0.15+10-LTS, mixed mode)


I was checking the BayeuxClient state in different error scenarios.

When I have error in /meta/connect channel the BayeuxClient returns the following states:

{"clientId":"*****","advice":{"reconnect":"none","interval":0},"channel":"/meta/connect","id":"7","error":"400::Authenticated user id does not match the session's user id","successful":false}

CLIENT STATE isHandshook=false, isConnected=false, isDisconnected=true

Here we are doing a re-handshake, which fails with TimeoutException because of some local environment issue. We receive the error on /meta/handshake channel

{"failure":{"exception":"java.util.concurrent.TimeoutException: Network delay expired: 30000 ms","message":{"ext":{"replay":true},"supportedConnectionTypes":["long-polling"],"channel":"/meta/handshake","id":"8","version":"1.0"}},"channel":"/meta/handshake","id":"8","successful":false} 

This time the BayeuxClient client state is returned as follows: CLIENT STATE isHandshook=false, isConnected=false, isDisconnected=false

This is kind of a state we are not able to make any decision on. I believe the client is doing the re-handshake internally. But if we want to take the control then we need to have a definite state as if the client is already disconnected or not.

Can I request an explanation here? If the client is re-handshaking in the background we need to know that. Also, we need to know in what scenarios the client does the re-handshake on its own.


Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

sbordetcommented, Oct 7, 2022

But if subscription fails, ideally the client should fail too. Isn’t it? There is no point of the client being connected but not receiving any message.


The client can look at the subscription failure, and decide to report something to the end user, for example.

That one subscription failed does not mean that the others don’t work.

Imagine you can subscribe to /userChat but you cannot subscribe to /adminChat because you’re not an admin. You still want to receive the /userChat messages so it’s perfectly fine to remain connected.

dyutimancommented, Oct 6, 2022

Thanks a lot for clarifying!

Read more comments on GitHub >

github_iconTop Results From Across the Web

BayeuxClient.State (CometD :: Java 4.0.9 API)
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate...
Read more >
Enum BayeuxClient.State - Java 7.0.9 API
declaration: package: org.cometd.client, class: BayeuxClient, enum: State. ... State assumed when this BayeuxClient is connected to the Bayeux server.
Read more >
BayeuxClient (CometD :: Java 4.0.9 API)
BayeuxClient is the implementation of a client for the Bayeux protocol. A BayeuxClient can receive/publish messages from/to a Bayeux server, ...
Read more >
Uses of Class org.cometd.client.BayeuxClient.State
Performs the handshake with the given template and waits at most the given time for the handshake to complete. static BayeuxClient.State, BayeuxClient.
Read more >
BayeuxClient (CometD :: Java 7.0.9 API)
A strategy to controls wait times of the retry attempts in case of heartbeat failures. · A channel scoped to this BayeuxClient. ·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found