i threw some example code [1] on gist to supplement my comment. i modified it a bit and didn't test it- but it used to work- so probably still good for reference. it's also not very pretty. questions, comments, concerns welcome.
essentially, it gives you two-way communication to your server on any arbitrary domain- that's pretty powerful!