forked from RocketChat/Rocket.Chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Real time messaging APIs
SingLi edited this page Aug 18, 2015
·
4 revisions
Rocket.Chat's real time messaging API is a thin semantics layer on top of Meteor's DDP. To access Rocket.Chat's internal message streaming firehose directly from an external client application:
// Connect to Rocket.Chat via DDP
connection = DDP.connect('http://localhost:3000');
//// LISTEN EVENT
// Create a new collection to monitor typing events in remote connection
collection = new Meteor.Collection('stream-typing', connection);
// Subscribe to typing events
connection.subscribe('stream-typing');
// Handle events on add of collection and reserve an especial item of
// type subscriptionId to be used with Meteor Calls
collection.find({}).observe({
added: function(item){
if (item.type == 'subscriptionId') {
window.subscriptionId = item._id;
}
console.log(item)
}
});
//// EMIT EVENT
// Call stream on connection passing subscription id and arguments
// first argument must be event name, stream-typing is the stream name
connection.call('stream-typing', subscriptionId, ['typing', {room: 'GENERAL', username: 'rodrigo.rocket.team', start: true}]);
- Mobile app for iPhones, iPads, iPod Touch
- Firefox OS native app
- Using Face to face video conference (aka webrtc)
- Remote Video Monitoring
- LDAP Authentication
- Creating the First Admin
- How to Build Rocket.Chat for Android
- Build the Android Cordova Web App and connect to your own Rocket.Chat Server