-
Notifications
You must be signed in to change notification settings - Fork 208
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
How to keep connection open? #54
Comments
The question is why does your server drop the connection after 120 seconds of inactivity? Browsers do not normally act this way if you start sending at least some data (for example the |
Yeah, like @ooxi says, I'm not seeing why the server would shut the connection if not data is being sent down it. If the server is closing the connection, because Oboe is a client-side library so there's not much it can do to influence the behaviour on the server. The only client side answer I can think of is to have the client re-open the connection when it goes down. You'd probably lose messages sent in the meantime though. If you want to filter out fake data, you could always tag 'real' data with an attribute and then detect it like: |
@goloroden What languages/frameworks are you using on your server-side? I would encourage you to ask the question there since as @jimhigson mentioned, this is out of Oboe's control. Would love to help though! |
We are using Node.js on the server. |
@goloroden I think you might be able to achieve this using the keep-alive http header. You could pass it with oboe like this oboe({
url: 'http://localhost:3000/data',
headers: {
'Connection' : 'keep-alive'
}
}) You need to teach your node server how to handle that header though since it seems like there's no official spec for it. I haven't tried it, but you could try using the agentkeepalive module. Hopefully that works, I would be interested to find out how it goes! |
Supposed I send some JSON data to the client using Oboe.js that is created dynamically by the server. From time to time, creation of this data takes some time, so after 120 seconds of inactivity, the connection is closed.
How can I force the connection to stay open infinitely?
The most obvious approach is using a timer and sending some fake data, but this means that my client app has to filter out the fake data.
Is there a better approach?
The text was updated successfully, but these errors were encountered: