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

Question about long polling and duplicate poll requests #38

Closed
MSE99 opened this issue Sep 22, 2022 · 1 comment
Closed

Question about long polling and duplicate poll requests #38

MSE99 opened this issue Sep 22, 2022 · 1 comment

Comments

@MSE99
Copy link

MSE99 commented Sep 22, 2022

In test-suite.js there's a test that checks if the server closes the session and sends a 1 close packet when the client makes duplicate poll requests at the same time here, I have two questions about that:

  1. Why is it a problem that the client can make duplicate poll requests?
  2. What is the best way for a server to detect that the client made a duplicate poll request i was thinking of doing something with a timestamp we can attach a timestamp to the session and check it when the client makes a poll request.

I'm making my own engine.io implementation and I never done something like this before so i apologize for my ignorance, thanks :).

@darrachequesne
Copy link
Member

Hi!

  1. Why is it a problem that the client can make duplicate poll requests?

That's a great question. I think that this is to ensure the ordering of the packets. Also, what would be the benefit of multiple long-polling requests?

  1. What is the best way for a server to detect that the client made a duplicate poll request

You need to make sure the HTTP request effectively acquires a read lock. In the Node.js implementation, the ongoing HTTP request is stored in the socket.transport object: https://github.com/socketio/engine.io/blob/917d1d29e13f2e8f523c3738f6413f67b587aebe/lib/transports/polling.ts#L18

I'm making my own engine.io implementation

That's awesome! Do not hesitate if something is not clear enough 👍

@MSE99 MSE99 closed this as completed Sep 23, 2022
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