Terminate socket connection completely
See original GitHub issueDescribe 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:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can not share whole code because company privacy.But also I can quickly prepare a program which is simulate this bug.
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.