Skip to content

Commit

Permalink
more gateweay docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed May 4, 2023
1 parent 324cd3f commit 3a3efe1
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions website/docs/developer/cloud/gateway.mdx
Expand Up @@ -102,6 +102,17 @@ Otherwise, you can also work on the simulator device using the local host connec
Device messages are pushed into the `messages` [Azure Storage Queue](https://learn.microsoft.com/en-us/azure/storage/queues/storage-queues-introduction) as a base-64 encoded JSON string.
You can use any client library to access those messages.

## GitHub Codespaces

Running the local web server from [GitHub Codespaces](https://github.com/features/codespaces)
allows you to run the Development Gateway in the cloud, which simplifies many connectivity issues with local networks.

The Development Gateway can be run in a browser using [codesandbox.io](https://codesandbox.io/).

- go to https://github.com/microsoft/devicescript-gateway/ (or your forked repository)
- click the down arrow on **Code**
- click `create codespace on main`

## Codesandbox.io

Running the local web server from [CodeSandbox.io](https://codesandbox.io/)
Expand All @@ -116,10 +127,15 @@ The Development Gateway can be run in a browser using [codesandbox.io](https://c
## MQTT

The gateway can also be used as an MQTT server or a bridge to an existing MQTT server.
You can configure a MQTT server by providing the `DEVS_MQTT_SERVER` environment variable.

- `publishMessage`, `subscribeMessage` from "@devicescript/cloud" will automatically be bridge to the MQTT server under the topic `devs/{deviceId}/(from|to)/{topic}`.
- You can use the [MQTT Client](https://marketplace.visualstudio.com/items?itemName=kwkmp.mqttclient) in Visual Studio Code to connect to the MQTT server
and publish, subscribe to topics.
- You can override the `devs/.../from/...` routing scheme by starting your topic with `/`. For example, `/mytopic` will be routed to `mytopic`.

::: tip
You can use the [VSMqtt](https://marketplace.visualstudio.com/items?itemName=rpdswtk.vsmqtt) in Visual Studio Code to connect to the MQTT server
and publish, subscribe to topics.
:::

## Azure deployment (optional)

Expand Down

0 comments on commit 3a3efe1

Please sign in to comment.