question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Terminate socket connection completely

See original GitHub issue

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);
    }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Jun 10, 2020

I can not share whole code because company privacy.But also I can quickly prepare a program which is simulate this bug.

0reactions
msftbot[bot]commented, Jun 15, 2020

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. If it is closed, feel free to comment when you are able to provide the additional information and we will re-investigate.

See our Issue Management Policies for more information.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to completely destroy a socket connection in C
To terminate the accept() ed connection close the accepted socket (what you call connected) by optionally first using shutdown() followed by ...
Read more >
Close a Socket
If a stream socket is closed when there is input data queued, the TCP connection is reset rather than being cleanly closed.
Read more >
Protocol for closing a socket connection
Just close() the socket from both ends. Depending on the timing, the TCP FIN and ACK sequences may or may not occur sequentially...
Read more >
Socket.Close Method (System.Net.Sockets)
The Close method closes the remote host connection and releases all managed and unmanaged resources associated with the Socket. Upon closing, the Connected...
Read more >
Sockets: Close vs. Shutdown
Executing a closing operation, in turn, ends the connections of a socket (if any), and also closes its file descriptor, finally destroying the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found