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

TCP server stops streaming; bug or intentional? #33

Closed
mik3y opened this issue Jan 26, 2021 · 3 comments · May be fixed by #34
Closed

TCP server stops streaming; bug or intentional? #33

mik3y opened this issue Jan 26, 2021 · 3 comments · May be fixed by #34

Comments

@mik3y
Copy link

mik3y commented Jan 26, 2021

Hi there! I have what may be a silly question about the intended usage of the TCP listener (./rtl_ais -T)

When I run rtl_ais in this mode, and connect a new client to the host and port (eg telnet localhost 10110), the client receives a burst of buffered messages, then nothing further. Sending a character from the client causes the connection to be closed.

What I'd expect: The client receives buffered messages, and continues to receive all newly-parsed messages, until either side terminates the connection.

Taking a look at docs and code, I can't quite see anything I'm doing wrong, so I'm thinking this is either intentional or perhaps just disused. Before I prep a PR, can you share any insight? Thanks for maintaining this!

@dgiardini
Copy link
Owner

dgiardini commented Jan 26, 2021 via email

@mik3y
Copy link
Author

mik3y commented Jan 27, 2021

Hey David - Thanks very much for the fast reply! That makes sense now; OpenCPN is the main client, and it sounds like it is perfectly functional repeatedly connecting.

I'm going to prepare a patch that can keep the connection open, and will send it your way. I'll do so in a way which avoids breaking existing applications like this; perhaps a command line flag for "keep TCP connection open".

FYI: This mode of operation would make rtl_ais work like similar applications that exist in the ADS-B (plane tracking) world: dump1090 and readsb/readsb-proto being the most popular. I am building a web application that can visualize data from both (airdash), so it will be great to support ais similarly. Cheers!

mik3y added a commit to mik3y/rtl-ais that referenced this issue Jan 28, 2021
When giving the `-T` flag, historical behavior is that the previously
received, buffered messages are streamed to the client, and then no
more. The socket is kept open until either the client closes it, or until
the client sends any data, at which point the client is disconnected.

When the `-k` flag is given in addition to the `-T` flag, an alternative
behavior is now implemented: As new messages are decoded, they
are sent to any attached clients in realtime. The client does not
need to disconnect to continue receiving updates.

Closes dgiardini#33
@mik3y
Copy link
Author

mik3y commented Jan 28, 2021

Just a short update: I've got this feature implemented now, in my branch here: mik3y@8507fbc . It is implemented as an opt-in feature (-k) so that if anything depends on the old behavior, it shouldn't break.

I'll be giving it some time testing, then will PR here. Cheers!

mik3y added a commit to mik3y/rtl-ais that referenced this issue Jan 28, 2021
When giving the `-T` flag, historical behavior is that the previously
received, buffered messages are streamed to the client, and then no
more. The socket is kept open until either the client closes it, or until
the client sends any data, at which point the client is disconnected.

When the `-k` flag is given in addition to the `-T` flag, an alternative
behavior is now implemented: As new messages are decoded, they
are sent to any attached clients in realtime. The client does not
need to disconnect to continue receiving updates.

Closes dgiardini#33
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

Successfully merging a pull request may close this issue.

2 participants