Skip to content

Instantly share code, notes, and snippets.

Setting my status.

Alex Russell slightlyoff

Setting my status.
Block or report user

Report or block slightlyoff

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
slightlyoff /
Last active Apr 17, 2019
Delivering H/2 Push Payloads To Userland


One of the biggest missed opportunities thus far with HTTP/2 ("H/2") is that we are not yet able to sunset WebSockets in favor of H/2. Web Sockets and H/2 both support multiplexing messages bi-directionally and can send both textual and binary data.

Server Sent Events ("SSE"), by contrast, are not bi-directional (they're a "server-push-only" channel) and binary data cannot be sent easily. They are, however, very simple to implement. Adding to the menagerie of options, RTCPeerConnection can also be used to signal data to applications in a low-latency (but potentially lossy) way.

Because H/2 [does not support the handshake (upgrade) that WebSockets use to negotiate a connection](

slightlyoff /
Last active Jun 7, 2018
Service Worker + Push API


The current Push API Draft specifies a system that has no notion of push channel persistence. Further, it does not include push message payloads, a feature that many developers want.

This gist outlines an API which:

  • integrates with the Service Worker to enable delivery of push messages to applications which do not have visible tabs
  • enables a JSON-formatted body of content
  • guards access to registration for pushes on potential user consent
slightlyoff / error-first-futures-examples.js
Created May 1, 2013
Error-first callback style Futures.
View error-first-futures-examples.js
var log = console.log.bind(console);
// Like .then(), except we move to a single callback
asyncAPI().when(function(err, value) {
if (err) {
// error handling/recovery
// ...
// If return is instanceof Error, continues error chain
return new Error(err.toString());
slightlyoff / connectionchange.js
Last active Dec 12, 2015
connectionchange event properties
View connectionchange.js
class ConnectionInfo {
classId=0) { = media;
this.className = className;
this.classId = classId;
View ctrl.js
// ctrl.js
// origin:
// scope: "/*"
"use strict";
// Called when this controller is installed as the newest version
// for a scope. Perhaps a clearer name for what is now sketched
// as "onupdate". Note that this is called BEFORE "onupgrade" is
// sent to a previous version's controller.
You can’t perform that action at this time.