javascript

Javascript push notifications with Django & Pusher

I've been running into an increasing need for JS push notifications and have played with a few ways of doing it. Recently ran across Pusher API. They use a combo of HTML5 websockets & flash fallbacks. Much easier than Comet, etc.

But their python library didn't support presence. Here's everything you need to make presence work in Django, including an updated library.

My JS


var pusher = new Pusher('MY_PUBLIC_KEY');
Pusher.channel_auth_endpoint = '/api/pusher/auth/'
var channel = pusher.subscribe('presence-meeting-1')

jQuery .serialize() returns empty string

In case anyone else runs into this:

I kept hitting my head, wondering why jQuery's serialize() would return an empty string for my form.

The reason was that I hadn't specified name attributes ( I was only using IDs ) for form elements, as I was dealing with the form via AJAX and hadn't had a reason to need them.

Simple fix, annoying to find

delving into JavacriptMVC

Back-story: I just started a new big web app project today.

In my never-ending quest for better front-end javascript design patterns, I decided to give javascriptMVC a shot. Their tagline?

JavaScriptMVC is a framework that brings methods to the madness of JavaScript development. It guides you to successfully completed projects by promoting best practices, maintainability, and convention over configuration.

Syndicate content