Files
meteor/examples/other/client-info/client-info.js
2014-08-29 12:28:32 -07:00

20 lines
491 B
JavaScript

if (Meteor.isServer) {
Meteor.publish("clientInfo", function () {
var self = this;
self.added("clientInfo", "info", {
clientAddress: self.connection.clientAddress,
httpHeaders: self.connection.httpHeaders
});
self.ready();
});
}
if (Meteor.isClient) {
Meteor.subscribe("clientInfo");
var ClientInfo = new Mongo.Collection("clientInfo");
Template.info.info = function () {
return EJSON.stringify(ClientInfo.findOne("info"), {indent: true});
};
}