WebSocket

Our invoice system has also been extended and greatly improved to support websockets with fallback to the standard Comet technology used before.

This will bring overall superior improved performance in providing payment complete notification for customers checking-out throughout all of BIPS’ Bitcoin invoice systems, or at bricks-and-mortar retailers using BIPS Point of Sale with minimal delays.

WebSockets defines a full-duplex single socket connection over which messages can be sent between client and server, and represents the next evolutionary step in web communication compared to Comet and Ajax.

However, each technology has its own unique capabilities, so we still allow connections and fallback to Comet technology.

Sample WebSocket Hook

jQuery(document).ready(function() {
  var ws = new WebSocket('wss://bips.me/ws/Public ID');
  jQuery(window).bind('beforeunload', function() {
    if (ws != null) {
      ws.close();
      ws = null;
    }
  });
  ws.onmessage = function (event) {
    var obj = jQuery.parseJSON(event.data);
    if (!jQuery.isEmptyObject(obj)) {
      // Check against generated address and amount
      // obj.address
      // obj.amount
      // obj.txid
    }
  };
});