Getting started with JSON & Binary in the JS client

Philip Aston - April 17, 2017

With the release of Diffusion 5.7 two new topic types have been introduced; JSON & Binary. The former is especially useful for users of the JavaScript client, since JSON is the defacto standard for handling data in web-applications and enjoys native support in JS.  This article will go through some simple examples of using these new topic types, and explain where best to use them.

Data Types

JSON and Binary topics introduce the notion of datatypes. These are fully explained here, but in essence provide consistent guarantees around data and operations that can be performed on that data, such as creating deltas.

Datatypes are used in the API to derive values for use in updating topics, and also to create value streams for a particular set of topics. The API exposes these as part of the top-level diffusion namespace.

To subscribe to a topic and receive datatype values, one creates a stream as normal, and then specialises it by providing the datatype to Stream#asType. Listeners for value, subscribe & unsubscribe events can then be bound. It’s important to note that only events for topics that are of the same datatype will be emitted.

The Diffusion Intelligent Data Mesh manages, optimizes, and integrates data among devices, systems, and applications. Push Technology pioneered and is the sole provider of real-time delta data streaming™ technology that powers mission-critical business applications worldwide. Leading brands use Push Technology to fuel revenue growth, customer engagement, and business operations. The products, Diffusion® and Diffusion Cloud™, are available on-premise, in-the-cloud, or in a hybrid configuration, to fit the specific business and infrastructure requirements of the applications operating in today’s mobile obsessed, everything connected world. Learn how Push Technology can reduce infrastructure costs, and increase speed, efficiency, and reliability, of your web, mobile, and IoT application.

Learn More: View Blog Posts and Developer Resources


Check out these other resources


Info Center

Case Studies, White Papers, and Tech Talk notes relating to Diffusion and the customers benefiting from using it.


Quick Start Guide

Step-by-step guide to getting started fast with Diffusion or Diffusion Cloud.


Diffusion Cloud

Get the facts and the details about our Diffusion Cloud platform.