This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var registerTopicListener = function (session){ | |
var listener = { | |
onDescendantNotification: function() {}, | |
onTopicNotification: function(topicPath, topicSpecification, type) { | |
addUser(topicPath); | |
}, | |
onClose: function() {}, | |
onError: function(error) {} | |
}; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
session.stream(chatTopic).asType(diffusion.datatypes.json()) | |
.on('value', function (topic, specification, newValue, oldValue) { | |
appendMessageToChat(newValue.value.get(), '#chatmessages'); | |
}); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sendTextMessage = function(session){ | |
var input = $("#chatinput").val(); | |
$("#chatinput").val(''); | |
if(session.isConnected() && (input.replace(/\s/g, '').length > 0)){ | |
var message = { | |
origin: chatUserId, | |
type: 'txtmsg', | |
payload: input | |
}; | |
session.timeseries.append(chatTopic, message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var createTopic = function(topicPath){ | |
var specification = new diffusion.topics.TopicSpecification( diffusion.topics.TopicType.TIME_SERIES, { | |
TIME_SERIES_EVENT_VALUE_TYPE : "json", | |
TIME_SERIES_SUBSCRIPTION_RANGE : "limit 30000", | |
TIME_SERIES_RETAINED_RANGE : "limit 30000" | |
}); | |
session.topics.add(topicPath, specification); | |
session.subscribe(topicPath); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
topicControl.addTopic(topicPath, | |
TopicType.JSON, | |
callback); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TopicControl topicControl = session.feature(TopicControl.class); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Session session = Diffusion.sessions().open("ws://localhost:8080"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var diffusion = require('diffusion'); | |
// Connect to Reappt with requester credentials | |
diffusion.connect({ | |
host : 'approvingBoldDaVinci.us.reappt.io', | |
port : 443, | |
secure : true, | |
principal : 'requester', | |
credentials : 'retseuqer' | |
}).then(function(session) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var diffusion = require('diffusion'); | |
// Connect to Reappt with admin credentials | |
diffusion.connect({ | |
host : 'approvingBoldDaVinci.us.reappt.io', | |
port : 443, | |
secure : true, | |
principal : 'admin', | |
credentials : 'nimda' | |
}).then(function(session) { |
NewerOlder