Closed jsmestad closed 2 years ago
@jsmestad thanks for the question. Are you just trying to change the frequency of the heartbeat?
I am getting a bunch of phx_close
events from the client to the server, so in an effort to debug I started to look to see if Heartbeat was even getting sent from the connection. As I started tracing through the Socket initialize methods, I cannot find a test or any code that makes me think the heartbeat timer ever starts.
I must be totally missing it... 🙃
The heartbeat timer gets recreated once the connection has been opened using the heartbeatInterval
. If you're changing that interval after the connection is opened then it won't affect the heartbeat.
Which client version are you using?
Also have you provided a logging closure to the socket? That will print out everything that is happening client side.
socket.logger = { msg in print("LOG:", msg) }
@dsrees ah there it is! I was going crazy thinking it had to exist.
I am using master
at the moment
@davidstump @dsrees thanks for the library. This may be a foolish question, but how do you configure the heartbeat? I am setting
socket.heartbeatInterval = 1000
but it does not appear to do anything in practice. Reading through the code, I cannot see wheresocket.heartbeatTimer
is getting initialized. The only place I can find the heartbeat being set is inresetHeartbeat()
. I have to be missing it, could you point me in the right direction?