Skip to content

Question about the heartbeat #32

Closed

Description

@AdamGrzybkowski

Will the error callback on PhxSocket be called when sending heartbeat fails?

From what I've seen it does not, but what is the purpose of the heartbeat then?

Activity

  1. AdamGrzybkowski commented on Feb 8, 2019

    @AdamGrzybkowski
    ContributorAuthor

    @dsrees hmm I think I know what could be the issue. If I'm not wrong the reconnectTimer is not initialized.

    So basically if the heartbeat fails the connection is closed and nothing more happens.

    Could you pls look at that?

  2. dsrees commented on Feb 8, 2019

    @dsrees
    Owner

    Hm, good catch. If the heartbeat fails, the reconnect timer is supposed to trigger and attempt to re-establish with the server. I'll take a look into this. Thanks for reporting it!

  3. AdamGrzybkowski commented on Feb 8, 2019

    @AdamGrzybkowski
    ContributorAuthor

    I think this is whats missing AdamGrzybkowski@32c719f

    But this still wouldn't make possible for me to know the status of heartbeat push. So I have to use autoreconnect feature from the lib, because I cannot handle this myself.

  4. dsrees commented on Feb 9, 2019

    @dsrees
    Owner

    That commit looks good, if you want to get a PR open

    What are you trying to do specifically with the heartbeat?

  5. AdamGrzybkowski commented on Feb 10, 2019

    @AdamGrzybkowski
    ContributorAuthor

    PR created.

    About the heartbeat.
    Right now we do have a problem that sometimes WS connection is killed without any kind of callback (onError or onClose). The only way to know that it was dropped is the heartbeat (or more precisely when it fails), that's why I thought it would good to know that.
    Ofc this is not needed if we can rely on the lib logic to reconnect but sometimes we might want sth more custom.

    In my case I always want to keep the connection open so I had to add some reconnection logic when onError is called as the lib was only handling reconnecting when the WS was closed(as it turned out it didn't :P). Right now to do what I need I will have to have reconnection logic: one handled by me and one by the lib. I would prefer to handle this in one place.

  6. dsrees commented on Feb 10, 2019

    @dsrees
    Owner

    Available in 0.1.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions