IoT Chat has been updated to work with AMQP, MQTT, and HTTPS. The new service is up and running. To set up a new free account go to the IoT Chat website. There are sample source code on how to use it on:
- Raspberry Pi in Java for Linux distributions (Raspbian, Ubuntu, etc)
- Raspberry Pi in C# for devices running Windows IoT
- C for Arduino -coming soon!
Some of the information below is out of date and will be updated soon. For more up-to-date information, visit the IoT Chat website.
IoT Chat is a messaging platform built on Azure that lets any IoT device communicate with any other device in the world. The main goal of IoT Chat is to provide a robust and easy-to-use platform that will allow IoT developers and hackers to concentrate on what makes their projects special and not have to worry about all the plumbing associated with creating a messaging network to support their projects. You will be able to create 100% connected solutions by using a few simple REST API calls.
The entire back end of IoT Chat is built on top of Azure. These are the Azure services currently in use:
· Azure API App
· Azure Storage
· Azure SQL
· Redis Cache
· Future versions will use either Service Bus or RabbitMQ on Azure.
Currently the service only supports the HTTP protocol. AMQP and MQTT support is still in the design phase. SSL is enforced throughout the service so you need hardware that supports SSL. Luckily MKR1000 has full support for SSL.
The service supports sending text and binary messages. Binary messages are still in test mode so only try it if you are brave! Communication with the service is completely encrypted. You also have the option of pre-encrypting your messages before you send it to the service for better security.
Go to https://iotchat.azurewebsites.net and register for a free account. Once you have activated your account, log into the site, click on the “System” link at the top of the page, and give your system a name. A system is basically a way to organize your devices in logical groups. At the moment each account can only have one system.
Click on the “Devices” link to start adding devices. Click on the “Add Device” button and enter a unique name. The “Enabled” checkbox lets to you enable/disable your device. This is useful if you want that device to stop receiving messages. You can re-enable the device at a later time. The “Searchable” checkbox controls whether or not you want your device to be searchable in the system. It is recommended that you turn this off after you have connected with the other devices you wish to connect to in case this device is not meant to be publicly visible.
Adding device friends is the way you connect to other devices. You can connect with devices in your own system or with other devices in other systems. Find friends by using the search box. Once you have found a device you want to connect with, simply click the “Add” button. The owner of the other device needs to accept your request to connect in order for the two devices to be allowed to communicate with each other.
In your devices list there is a “Create Token” button for each device. This will give you an access token that you will need to paste into your code in order to authenticate with the service. There is also a “Create New Reset State” button. This button allows you to invalidate the access token in case that the access token has been stolen or otherwise compromised. After clicking this button, you will need to create a new access token and compile it into your program. At the moment the access token will be valid for one year. In future versions of this service the access token will be valid for much less time in order to make it more secure. The new version will also use refresh tokens in order to ensure that your devices keep working without having to compile in new access tokens into your code.
I used a MKR1000 for the Arduino side and a Microsoft Lumia 550 phone for the Windows 10 side. No other hardware was used in developing the two clients other than my Windows 10 PC and Mac. I developed the Windows 10 Client using Visual Studio 2015 on my PC and Arduino 1.6.7 on my Mac.
Go to https://github.com/cubixoft/iotchat-arduino/blob/master/IoTChat_Client.ino to get the sample IoT Chat Arduino client.
The top of the sketch has 3 settings that you must set.
· Your WiFi SSID
· Your WiFi password
· The device access token you got from the IoT Chat web site.
const char PROGMEM wifi_ssid = "Your WiFi SSID"; const char PROGMEM wifi_password = "Your WiFiPassword"; const char PROGMEM h_access_token = "Authorization:Bearer <Enter your device's access token here>";
The client polls the messaging service every 10 seconds to see if there are any messages available. If there are, it responds back to its sender with the message: “Thanks for saying ->” followed by the message that was received. It is a very simple interaction, but the possibilities are endless. With this small sketch you can interact with any device in the world you grant access to without having to build an entire infrastructure from scratch!
Note: Make sure you do not poll more frequently than 10 seconds, future versions will throttle you if you go below this threshold.
This is where it gets fun. This client lets you send and receive messages from any Windows 10 device or computer. Go to https://github.com/cubixoft/iotchat-uwp to get the UWP client project. Open up Constants.cs and edit the following lines:
internal const bool AutomaticMode = false; internal const string FriendName = "<Enter thedevice's friend name here>"; internal const string AccessToken = "<Enter yourdevice's access token here>";
Set “AutomaticMode” to false in order to send and receive messages to a friend. Set “FriendName” to the device name of the device you want to communicate with and set “AccessToken” to your device’s access token. Setting “Automatic Mode” to true turns your client into a “Magic 8 Ball” response device where any message received gets a random “Magic 8 Ball” response sent back. This is useful if you are just testing communication from your MKR1000 to a Windows 10 device.
IoT Chat is a centralized messaging platform for all IoT devices. It allows any device to discover and securely send messages to any other device in the world. This will enable easy discovery and seamless communication without having to build an isolated system that only serves one device or a handful of devices. IoT Chat will make it possible to unleash the communication power of billions of devices that are currently isolated from the rest of the world and cannot share nor consume valuable information because there is no centralized system that allows all devices to communicate. My vision is to create what we all secretly want -seamless communication between devices and sharing anything with any device in the world.
Please provide me with any feedback on desired features, bugs, enhancements, etc.
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!