Open Fishdrowned opened 7 years ago
It keeps creating new connections about every 30 seconds.
I can see the call stack by hanging mouse over the Initiator
.
The first connection, looks OK, it was initiated by subscribe()
:
The second connection, no good:
The third connection, wow, look at the scroll bar, it gets longer:
because the client default timeout is 30s, and the server default timeout is 120s. you can set the client timeout more than 120s to fixed problem.
Thank you for your reply, I've extended the client timeout to 1 day, it stops creating new connections.
But look at the 1st screenshot, it indicates that the old connections are not closed (status = 101
and time = Pending
means the connection is still alive), but new connections are created.
PS. The term heartbeat
is misleading, I expected it to send some ping
frames to the client to keep connection open.
When timeout on client, the connection will not to be closed, because maybe some other requests on this connection too.
The problem is, by default settings, client.subscribe()
will keep creating connections as time grows, keep them open, not reusable, never closed, just like memory leak.
I guess this should be a architecture issue, but I don't have enough time to investigate and prove this.
Sets the client timeout to 1 day or some big number is just a workaround.
I implemented a manual but real heartbeat in my application, by pushing an empty string to the subscribers every minute.
Yes, you are right. I will try to fix this problem in next version.
I see this in Chome devtool >> Network:
Client script:
Server script: