d-Rickyy-b / certstream-server-go

This project aims to be a drop-in replacement for the certstream server by Calidog. This tool aggregates, parses, and streams certificate data from multiple certificate transparency logs via websocket connections to the clients.
MIT License
81 stars 9 forks source link

Add support for server heartbeats #39

Closed alberts-s closed 4 days ago

alberts-s commented 1 month ago

Before this change the websocket server would not have any heartbeat mechanism, this meant that unless the client proactively implements heartbeats the server would close the connection. From what I have seen most non-browser clients do not implement heartbeats (e.g filebeat, websocat), thus for those clients the connection would have been closed in 65 seconds.

The Websocket RFC does not set out a requirement which side should initiate heartbeats or that they are required. Most browsers have implemented heartbeats from client side, however it is not a must thus, in my opinion it is beneficial for the server to implement them, especially if the server closes connection if heartbeat is not received. This would allow to support clients which aren't browsers.

d-Rickyy-b commented 1 month ago

Thank you for your effort! I agree that server side pings would be beneficial for clients that don't support sending out heartbeats.

If the PR is ready to merge, please add a line to the changelog.md that describes your change.

alberts-s commented 1 month ago

Hi @d-Rickyy-b, Thanks for the feedback and for the certstream server implementation in Go :) I have updated the changelog.

d-Rickyy-b commented 4 days ago

Hi @alberts-s and sorry for the late response. I had plenty of things going on and only now am able to properly review and test your changes. Despite the changes not being very huge, I still want to make sure everything is working properly. Thank you for your contribution!