Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cometd Client Headers #15

Closed
leenelc opened this issue Nov 4, 2018 · 6 comments
Closed

Cometd Client Headers #15

leenelc opened this issue Nov 4, 2018 · 6 comments

Comments

@leenelc
Copy link

leenelc commented Nov 4, 2018

How do I view the headers being sent in a cometdClient object? More specifically, the value of the headers that have not been pre-configured... for example the Bayeux Browser cookie header

@sbordet
Copy link
Member

sbordet commented Nov 4, 2018

This is not currently possible. Can you please specify why you want to do that? The more information we have, the more we can implement the feature in the correct way.

Also, reading HTTP response headers ties you to the HTTP transport. What if you want to use WebSocket?

@leenelc
Copy link
Author

leenelc commented Nov 5, 2018

For the purpose of the application I am building, I am going to be using the HTTP transport only.

When you say tied to the HTTP transport, does this mean that if I generate multiple cometdClients the Bayeux Browser cookie is to remain the same throughout all?

The reason I want to maintain the Bayeux Browser cookie is to emulate a publish using HTTP rather than saving the cometd client object itself.

@sbordet
Copy link
Member

sbordet commented Nov 5, 2018

When you say tied to the HTTP transport, does this mean that if I generate multiple cometdClients the Bayeux Browser cookie is to remain the same throughout all?

No, I am saying that if you use WebSocket in the future, your code will not work because there are no HTTP response headers.

The reason I want to maintain the Bayeux Browser cookie is to emulate a publish using HTTP rather than saving the cometd client object itself.

Why? I ask because maybe you want to do something on your own using raw HTTP that CometD can do already.

@leenelc
Copy link
Author

leenelc commented Nov 5, 2018

The application I'm building requires that I persist multiple cometd connections with the server.
However, I would rather not store the entirety of the cometd client object I am creating (this is to send publish requests using the same session)
The workaround I have found is to save the client_id, the nextMessageId and the bayeux browser cookie and send an HTTP request accordingly.

@sbordet
Copy link
Member

sbordet commented Nov 5, 2018

The application I'm building requires that I persist multiple cometd connections with the server.

This is not necessary in almost all cases. HTTP is a stateless protocol, so you don't strictly need persistent connections (although they are much more efficient).

I would rather not store the entirety of the cometd client object I am creating (this is to send publish requests using the same session)

What is the problem with storing the CometD client object?

The workaround I have found is to save the client_id, the nextMessageId and the bayeux browser cookie and send an HTTP request accordingly.

It won't work unless for a very short period of time. The server expects the client to send periodic heartbeats, otherwise it will declare the client dead and remove the session.

I feel you are going in the wrong direction based on wrong assumptions of how CometD and HTTP work.

So far you have explained your "solution" ("persist" connections, get rid of the CometD object, do raw CometD publishes by yourself), but you have not explained what is the problem yet and why you have decided to take all those uncommon "solutions".

I would recommend that you build your system using entirely the CometD APIs without worrying about "persisting" connections, storing or not the CometD object, etc.
When you have the system working, you can look at whether there is any problem.

@sbordet
Copy link
Member

sbordet commented Nov 5, 2019

No further activity, closing.

@sbordet sbordet closed this as completed Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants