Skip to content

Introduction to Diffusion Real-Time Messaging through a simple application using Diffusion Cloud. These JavaScript code examples enable users to interact in real-time across various rooms or topics. You can also use other programming languages from our SDKs.

Notifications You must be signed in to change notification settings

diffusion-playground/messaging-js-app

Repository files navigation

Video Tutorial

Real-Time Messaging

Introduction to Diffusion Real-Time Messaging through a simple application using Diffusion Cloud.

A set of simple projects, illustrating production and consumption of messages to and from a Diffusion Cloud instance.

These JavaScript code examples enable users to interact in real-time across various rooms or topics. You can also use other programming languages from our SDKs, including iOS, Android, C, .NET, and more.

Lesson 1: Publish and Subscribe to Topics

diffusion-msg-app-L1 introduces the concept of Publish and Subscribe to 'Topics' (data structures). In Diffusion, data is stored and distributed through Topics.

Lesson 2: Time Series Topics

diffusion-msg-app-L2 introduces the concept of Time Series topic to hold a sequence of events. Time series topics are useful for collaborative applications such as chat rooms. Multiple users can concurrently update a time series topic.

Lesson 3: Security

diffusion-msg-app-L3 introduces the concept of Security by requiring sessions to authenticate and use role-based authorization to define the actions that a client can perform.

The code in action

Video Tutorial

Pre-requisites

  • Download our code examples or clone them to your local environment:
 git clone https://github.com/pushtechnology/tutorials/
  • A Diffusion service (Cloud or On-Premise), version 6.5.0 or greater. Create a service here.
  • Follow our Quick Start Guide and get your service up in a minute!

Setup

Make sure to add Diffusion library to your code. For JavaScript, we have added the following line in our public/chat.html:

<script src='https://download.pushtechnology.com/clients/6.5.1/js/diffusion-6.5.1.js'></script>

Update public/js/app.js to the hostname of your Diffusion Cloud service, which you can find in your service dashboard. You can also leave the default values and connect to our sandbox service:

* host: 'diffusionchatapp.eu.diffusion.cloud'
* user: 'user'
* password: 'password'

About

Introduction to Diffusion Real-Time Messaging through a simple application using Diffusion Cloud. These JavaScript code examples enable users to interact in real-time across various rooms or topics. You can also use other programming languages from our SDKs.

Topics

Resources

Stars

Watchers

Forks