Amqp and WebSocket support in Azure IoTHub

Damir Dobric Posts

Next talks:



Follow me on Twitter: #ddobric




Azure IoT Hubs supports Amqp protocol as default fast transport. But there are few interesting variations, which are not well documented or not obvious.

For example, when implementing the device code you can specify explicitly the protocol, which should be used. As you see on the next picture, TransportType is a last argument of method CreateFromConnectionString.


Currently the DeviceClient API provides following protocols:

- Amqp_Tcp_Only,
- Amqp_Websocket_Only,
- Amqp


Native implementation in which the Amqp protocol runs over a secure TCP connection using port 5671.


Implementation of the Amqp protocol on top of the WebSocket protocol (RFC 6455) which in turn is running over a secure TCP connection using port 443. This option is very intersting in environments, when TCP 5671 port is not open and cannot be opened.
In that case the connection is initiated through HTTP/S port 443 and packets are tunneled through websocket, in  AMQP format.


This is the ultimate option, which can be used. It initially attempts to setup a Amqp_Tcp_Only connection. If it fails for any reason (like port 5671 being blocked), then it attempts to use Amqp_Websocket_Only connection automatically.

Posted Feb 23 2016, 11:59 AM by Damir Dobric is a .Net Community Blog powered by daenet GmbH.