Mar 09, 2014 07:29 AM|mconrad|LINK
The connection and hub methods are async methods. You are running the code within a non-async method (I guess it is a console app's Main...)
If you are using sync methods within the console's main, you cannot use the await keyword to wait for the task to complete the action, instead you use Task.Wait().
If you don't call Wait(), the thread would not get blocked and both task might run in parallel which might result in an error because it could be the case that the connection is not established and the second task tries to send something...
In addition if you do not pause the console app's thread, the application could simply terminate before even doing anything...
In short, this is just a way to run the code synchronously.