SGN-35016 - Internet of things and media services
Created by Iiro Nykänen & Ville Vaarala
Desire to do something with Android and/or Node.js
Started thinking how the most popular messaging applications have a closed source server, and may or may not do stuff with your data.
→ How about a messaging application that lets you host your own servers?
Provides ways to...
The code is available in GitHub, but it doesn't exactly follow good conventions...
Registration
Private messaging
Creating a channel
Channel chat
Joining a channel
Iot-integration
Users and channels are stored in the database.
Messages are just transmitted to the client app(s). They will never be stored in the database.
HTTP API provides endpoints for...
API is documented in the sp-server/README.md
file.
sails.hooks["sp-gcm"].sendToChannel(channel, sender, message);
sails.hooks["sp-gcm"].sendToUser(receiver, sender, message);
GCM is used to transmit chat messages to client devices.
For the SneakSpeak application we forked and modified an existing GCM XMPP library and also wrote a custom Sails.js hook for our project.
git clone https://github.com/SneakSpeak/sp-server.git
cd sp-server
npm install
Create a project for your server on Google Developer Console. Also add API key for your server.
Update Google Project Number, Server API Key and your database settings as instructed in README. Start the server:
npm start
Connecting IoT device to SneakSpeak
$ npm install git+https://github.com/SneakSpeak/sp-thing.git
var sneakSpeak = require('sp-thing')(
serverURL, userToken, channelID, thingName
);
var measurement = measureSomething();
sneakSpeak.send(measurement);
- Sources available in GitHub
- Demo server running on Heroku: sneakspeak.herokuapp.com
- Slides created using reveal.js, available at sneakspeak.github.io
Questions?