OpenXbox / xbox-smartglass-csharp

🎮.NET Standard client library for the Xbox One SmartGlass protocol
MIT License
68 stars 20 forks source link

SendGamepadStateAsync takes 2 minutes to send? #114

Open nathenxbrewer opened 2 months ago

nathenxbrewer commented 2 months ago

I'm trying to send buttons to my Xbox but it's taking about 2 minutes for the Xbox to respond. During this time, the ConnectAsync method throws a TimeoutException. I've tried 3 different Xbox One's in my house with the same result. Am I doing something wrong?


static async Task SendGamepadStateAsync(SmartGlassClient sgCLient, GamepadState pState)
    {
        pState.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
        await sgCLient.InputChannel.SendGamepadStateAsync(pState);
        pState.Buttons = GamepadButtons.Clear;
        pState.Timestamp = DateTimeOffset.UtcNow.ToUnixTimeSeconds();
        await sgCLient.InputChannel.SendGamepadStateAsync(pState);
    }`
nathenxbrewer commented 2 months ago

A bit more info:

https://github.com/OpenXbox/xbox-smartglass-csharp/issues/115

I see now that the console app is doing something similar. Apparently my ConnectAsync Task is not actually being awaited like I thought. So what seems to be happening is that it's taking ~2 mins for the ConnectAsync to finish, then the console will send the Gamepad state.

I'd still like to find out why it takes 2 mins for a connection to be made.