-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to await
ConnectAsync()
#117
Allow to await
ConnectAsync()
#117
Conversation
I don't think this is a good update as it will confuse people to think that after an await they can immediately call the websocket methods, instead of listening to the connect event |
Yes, I forgot that there is still a need for authorization. But one more NOTE can be added or At the moment I'm using |
Added a clarification. |
Sorry, I still don't understand why I would want to push this. It's confusing. |
I have already written this
Simplified version of my code: async void ReconnectionThread()
{
while (true)
{
try
{
await obs.ConnectAsync("ws://localhost:4455", "pass");
}
catch {}
if (obs.IsConnected || reconnectCancellationToken.IsCancellationRequested) return;
Thread.Sleep(4000);
}
} It's just a Task that runs when disconnected from OBS. It is as simple and convenient as possible. If you do the same without await, you may have problems trying to connect during another connection attempt or reconnecting when the connection is already established. |
Your code would work EXACTLY the same without that await, given there is nothing blocking in the ConnectAsync function. |
@BarRaider Will #100 be ignored? |
This PR does not change the behavior of this function in the already existing code.
But it allows you to wait for the connection attempt to complete.