Skip to content

Issue about the disconnect without reason #53

@mmMrz

Description

@mmMrz

Sometimes the program will be exited without reason
the close code is 1005
For the definition of code, refer to the definition document of Web Socket
https://www.rfc-editor.org/rfc/rfc6455#section-7.4

(Actually it's always 1005 when the dapp call loginout, the sdk will not notify program,and direct call disconnect then throw a code of 1005,for example, on opensea.io),see the following code.
close
listen
It is noteworthy that
_ webSocket._ webSocket._ closeCode
_ webSocket._ webSocket._ closeReason
There are values in.But obviously these are internal properties I can't access. In addition, I added the Reason and Close parameters on my own initiative.

So in the onDisconnect event, I can't determine whether it is an unexpected end or the user's active end
(If it is an accidental termination, I can reconnect and continue to communicate with DAPP, but if it is the user's active termination, there is no connection significance.)

The difference between the two is that when DAPP is disconnected, according to the official document of WalletConnect, a SessionUpdate method must be sent.
So I added this onSessionUpdate event and called it so that the program can determine whether to reconnect or disconnect
add function call
add function

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions