Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block push-gists

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
push-gists / gist:64f61b7c837849d4525f145627681922
Last active Oct 25, 2017
The agent client receives topic notifications about structural changes to the topic tree. In this application, the addition of a topic under /chat/chatsessions will mean that a new user has visited the website.
View gist:64f61b7c837849d4525f145627681922
var registerTopicListener = function (session){
var listener = {
onDescendantNotification: function() {},
onTopicNotification: function(topicPath, topicSpecification, type) {
onClose: function() {},
onError: function(error) {}
push-gists / gist:7ff4ddb0023337e6e6e143eb8d807fc9
Last active Oct 25, 2017
This code shows how we receive and display new chat messages. The client registers a callback which appends all incoming messages to an HTML element with the id 'chatmessages.' Each new value streamed will also have an associated author, sequence number and timestamp.
View gist:7ff4ddb0023337e6e6e143eb8d807fc9
.on('value', function (topic, specification, newValue, oldValue) {
appendMessageToChat(newValue.value.get(), '#chatmessages');
push-gists / gist:8ed8c52ca067700fb48a3d11bdc8917e
Last active Oct 25, 2017
Appending a new chat message to the time series topic. Using a JSON event to represent messages allows us to add extra metadata about the sender.
View gist:8ed8c52ca067700fb48a3d11bdc8917e
var sendTextMessage = function(session){
var input = $("#chatinput").val();
if(session.isConnected() && (input.replace(/\s/g, '').length > 0)){
var message = {
origin: chatUserId,
type: 'txtmsg',
payload: input
session.timeseries.append(chatTopic, message);
push-gists / gist:16098f2d32bcff0e62d20bd966d33aba
Last active Oct 25, 2017
Creating a Time Series Topic with a specification and subscribing to it. The specification determines how many events the topic retains and how many are received when the topic is subscribed to.
View gist:16098f2d32bcff0e62d20bd966d33aba
var createTopic = function(topicPath){
var specification = new diffusion.topics.TopicSpecification( diffusion.topics.TopicType.TIME_SERIES, {
session.topics.add(topicPath, specification);
View gist:e959feceefb87e047d37b33f401d381b
View gist:12fd7eda60d7f5288541198f06f53db9
Session session = Diffusion.sessions().open("ws://localhost:8080");
push-gists /
Created Jan 10, 2017
A Java Reappt client that subscribes another client to a topic
import java.util.Collection;
import com.pushtechnology.diffusion.client.Diffusion;
import com.pushtechnology.diffusion.client.callbacks.ErrorReason;
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl;
import com.pushtechnology.diffusion.client.features.control.topics.SubscriptionControl.SubscriptionByFilterCallback;
import com.pushtechnology.diffusion.client.session.Session;
import com.pushtechnology.diffusion.client.types.ErrorReport;
public class Gatekeeper {
push-gists / requester.js
Created Jan 10, 2017
A simple JS Reappt client that attempts subscription to topics with different permissions
View requester.js
var diffusion = require('diffusion');
// Connect to Reappt with requester credentials
host : '',
port : 443,
secure : true,
principal : 'requester',
credentials : 'retseuqer'
}).then(function(session) {
push-gists / keymaster.js
Created Jan 10, 2017
A simple JS Reappt client that updates the security and system authentication stores.
View keymaster.js
var diffusion = require('diffusion');
// Connect to Reappt with admin credentials
host : '',
port : 443,
secure : true,
principal : 'admin',
credentials : 'nimda'
}).then(function(session) {
You can’t perform that action at this time.