1

The communication between my server and custom test client is working.

I add a connection from my UWP and run it on my local windows and it is working.

When i deployed my UWP on raspberry running win iot core the signal isn't received, no errors displayed in the output.

Server:

class Program
{
    static void Main(string[] args)
    {
        // This will *ONLY* bind to localhost, if you want to bind to all addresses
        // use http://*:8080 to bind to all addresses. 
        // See http://msdn.microsoft.com/en-us/library/system.net.httplistener.aspx 
        // for more information.
        string url = "http://localhost:8080";
        using (WebApp.Start<Startup>(url))
        {
            Console.WriteLine("Server running on {0}", url);
            Console.ReadLine();
        }
    }
}
public class Startup
{
    public void Configuration(IAppBuilder app)
    {
        app.UseCors(CorsOptions.AllowAll);
        app.MapSignalR();
    }
}

TestClient:

public class Program
{
    public static void Main(string[] args)
    {
        //Set connection
        string url = "http://localhost:8080";
        var connection = new HubConnection(url);
        //Make proxy to hub based on hub name on server
        var myHub = connection.CreateHubProxy("TestHub");
        //Start connection

        connection.Start();

        while (true)
        {
            Console.ReadLine();
            myHub.Invoke("SendSignal");
        }
    }

}

UWP APP:

InitializeComponent();

pushButtonValue = GpioPinValue.High;
InitGPIO();

//Set connection
string url = "http://localhost:8080";
var connection = new HubConnection(url);
//Make proxy to hub based on hub name on server
var myHub = connection.CreateHubProxy("TestHub");

//Start connection    
myHub.On("ReceiveSignal", FlipLED);
connection.Start();


//timer = new DispatcherTimer();
//timer.Interval = TimeSpan.FromMilliseconds(50);
//timer.Tick += Timer_Tick;
//timer.Start();

I have no idea what to check/do next.

Why isn't the message received when my app is running on my PI?

1 Answer 1

1

The UWP App url probably isn't localhost since it is on a different machine now. That stumped me for awhile also.

Remember that connection.Start(); is async so that doesn't show you the exception. You can add a Wait() to it to get the exception.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.