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

WebSocket - full-stream being disconnected at regular interval #59

Open
adulau opened this issue Dec 18, 2020 · 3 comments
Open

WebSocket - full-stream being disconnected at regular interval #59

adulau opened this issue Dec 18, 2020 · 3 comments

Comments

@adulau
Copy link

adulau commented Dec 18, 2020

A small question, the WS connection to the full-stream disconnects with code 1000 (successful close) at regular interval. I used various WS libraries and I have the same behaviour. I looked into web.ex but cannot find code triggering the close.

I use the latest 26dff90 and used the following Elixir version

Erlang/OTP 22 [erts-10.6.4] [source] [64-bit] [smp:24:24] [ds:24:24:10] [async-threads:1]

Elixir 1.9.1 (compiled with Erlang/OTP 22)

Is it a common behaviour or a bug?

@adulau
Copy link
Author

adulau commented Dec 21, 2020

Complementary information, the Python client using WS from https://github.com/CaliDog/certstream-python/blob/master/certstream/core.py#L20 works as expected. I suppose it's the heartbeat.

@Fitblip
Copy link
Member

Fitblip commented Dec 21, 2020

Hi @adulau sorry for the delay in getting back to you.

A small question, the WS connection to the full-stream disconnects with code 1000 (successful close) at regular interval. I used various WS libraries and I have the same behaviour. I looked into web.ex but cannot find code triggering the close.

Yep, Erlang's cowboy webserver (which certstream uses) will disconnect clients that are idle after I think it's 60s. Basically it can't tell if a client is idle or if something else has gone wrong since we don't have a message acknowledgement system (which would be quite some overhead performance wise).

The simple solution is to send some data to the server at a specific interval, and the server will basically just ignore it, though it will stop your disconnect issue.

Unfortunately I think our support for heartbeats is a bit scattered at the moment, I went to scope out what it'd take for golang for example and it seemed like a non-trivial effort.

That said, I'm curious what language you're talking to certstream from, and if it'd make sense to make your language a supported one as well.

Cheers!

@Fitblip
Copy link
Member

Fitblip commented Dec 21, 2020

Ah here we go, check out idle_timeout - https://ninenines.eu/docs/en/cowboy/2.5/manual/cowboy_websocket/#_opts. I think originally I set this value really high on the server but as you can imagine never cleaning up idle sockets can lead to stability issues :).

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