O'Reilly logo

Getting Started with the Internet of Things by Cuno Pfister

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

HelloWeb

Example 10-1, our first web server program using a relay. Note that the relay domain and secret key used below are just examples that won’t work for you, so you need to provide your own values. Alternatively, if you only want to try out the server within your home network, you can just omit the RelayDomain and RelaySecretKey lines completely (or comment out by prefixing them with //), thereby switching off the relay mechanism.

Example 10-1. HelloWeb

using Gsiot.Server;

public class HelloWeb
{
    public static void Main()
    {
        var webServer = new HttpServer
        {
            RelayDomain = "gsiot-FFMQ-TTD5",
            RelaySecretKey =
                "o5fIIZS5tpD2A4Zp87CoKNUsSpIEJZrV5rNjpg89", RequestRouting = { { "GET /hello", context => { context.SetResponse("Hello Web", "text/plain"); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required