In my last post I mentioned the new CoderDojo which VersionOne is sponsoring, and that I’d start to show how we’ve built some software to help manage the dojo.One of the tools we built helps the students learn and share HTML and CSS snippets with each other in real-time. Basically, it’s an HTML-enabled chat tool.To build this, I used to handle messaging, AngularJS for the UI, and MongoDB via MongoLab for storing user accounts and saved favorites.

Example: Simple Messenger

Before looking at the full HTML chat, take a look at the code for this simple chat client out on Plnkr. PubNub calls itself an “Internet two-way radio with bidirectional JSON.” At least that’s what their catchy jingle says! You can see how simple it is to get started in the script file. You just call subscribe with a channel name and a callback function which the PubNub library code will call you back on for any new messages sent to that channel. To send, you simply call publish on a channel and pass a message object to it.

The Catch: MongoLab’s REST API Security (Lack of)

I’ll show the other code after I get it loaded in a more secure way. The problem is that the MongoLab REST API only supports user-account based API keys, not database-user-specific accounts. This isn’t very secure for data that is not mean to be public.

In the mean time, here’s a screen shot of the full app:

CoderDojo Ponce Springs Chat

Join the Discussion

    There are currently no comments.

    7 + 3 =