Introduction

As a developer, testing network conditions and connection persistence can be a challenge. Sometimes, network transportation isn’t always reliable, and it’s not easy to simulate a poor network connection during testing. Fortunately, I recently discovered clumsy, a tool that made it easy for me to test my SignalR connection persistence in a C# project. In this article, I will explain how clumsy was helpful for me and how it can be helpful for other developers.

Hub client

First let me show you the hub client I’m using in my project:

Solution

I used clumsy to intercept and manipulate network packets.

file

Here is one scenario that I used. I started my C# application that is using SignalR(old ASP.Net 🙄), letting it successfully connect to the hub. I then started clumsy, setting the filter to ip.DstAddr == 123.45.67.89 where the ip address 123.45.67.89 being the address of my SignalR hub. I then set Lag – delay to 1000ms and Drop chance to 90%. After hitting the Start button in clumsy inteface and little bit of a delay, I could see messages in console showing how my app was disconnected and is trying to reconnect. Note that I’m using Polly and it’s retry policies.

After hitting Stop button in clumsy, my application was able to successfully establish the SignalR connection again.

Using clumsy, I was able to test and debug my SignalR connection persistence quickly and efficiently. The tool allowed me to simulate various network conditions and observe how my application would handle them. I did not need to change any code in my application or install any additional software, making it a great tool for quick testing.

Conclusion

In conclusion, clumsy is an excellent tool for developers who want to test their application’s behavior under poor network conditions. It’s user-friendly GUI(It also has CLI! 👍), simple setup process, and the ability to intercept and manipulate network packets make it an essential tool in any developer’s toolbox. I was able to use clumsy to test my SignalR connection persistence quickly and efficiently, without needing to modify my application’s code. I highly recommend it to any developer who wants to ensure that their application can handle a wide range of network conditions.

Last modified: April 11, 2023
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments