Skip to content

Terminate socket connection completely #22700

@ghost

Description

Describe the bug

I am trying to terminate all connections with socket After I logout. when I logging out connection is disconnecting but I still receiving message from "ReceiveMessage" method. Is there any idea what
is wrong with code?
my code seems below

initConnection() {
  this.connection = new signalR.HubConnectionBuilder()
            .withUrl("/chat", {
                accessTokenFactory: () => {
                    return token;
                }
            })
            .withAutomaticReconnect([0, 1000, 2000, 3000, 5000, 9000, 15000])
            .build();
  }
  Tasks(){
        this.connection.on("ReceiveMessage", this.ReceiveMessage);
  }
    async Disconnect(){
        this.connection.off("ReceiveMessage", this.ReceiveMessage);
        this.connection.stop().then(() => {
            delete this.connection
        }).catch(console.log);
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Status: No Recent Activityarea-signalrIncludes: SignalR clients and servers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions