Skip to content

Instantly share code, notes, and snippets.

@benbrittain
Created July 30, 2014 19:46
Show Gist options
  • Save benbrittain/f6419292fe4b9cf1e04c to your computer and use it in GitHub Desktop.
Save benbrittain/f6419292fe4b9cf1e04c to your computer and use it in GitHub Desktop.
658 let ioservice = Cc['@mozilla.org/network/io-service;1'].getService(Ci.nsIIOService);
659 var aLoadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance(Ci.nsILoadGroup);
660 debug("mon: " + this._monitorURI);
661 debug("chan: " + this._channelURI);
662 let chan = ioservice.newChannel(this._monitorURI, 'UTF-8', null);
663 chan.loadGroup = aLoadGroup;
664 chan.notificationCallbacks = {
665 QueryInterface: XPCOMUtils.generateQI([Ci.nsIHttpPushListener,
666 Ci.nsIStreamListener,
667 Ci.nsRequestObserver]),
668 getInterface: function (iid) {
669 if (iid.equals(Ci.nsIHttpPushListener)
670 || iid.equals(Ci.nsIStreamListener)
671 || iid.equals(Ci.nsIRequestObserver))
672 {
673 //debug("Get Interface Success");
674 return this.QueryInterface(iid);
675 }
676 throw Cr.NS_ERROR_NO_INTERFACE;
677 },
678 onStartRequest: function (request, context) {
679 debug("----------------- start request receieved in PushService.jsm -----------------");
680 },
681 onStopRequest: function onStartRequest(request, context, statusCode) {
682 debug("(((((((((((((((((((((stop osr");
683 },
684 onPush: function (monitorConn, channelConn) {
685 debug("----------------- PUSH receieved in PushService.jsm -----------------");
686 //TODO: message the _send or something with the data and the channel
687 }
688 };
689 chan.asyncOpen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment