Hi guys I am writing a meteor app and using the ddp.js v0.6.0 to make my frontend with static html. Now I need a way to get my session connection id in the front with ddp.js, is there anyway to do it? In meteor I can just do Meteor.connection._lastSessionId
, is there any equivalent of this in ddp.js?
DDP.prototype._on_connected = function (data) {
var self = this;
var firstCon = self._reconnect_count === 0;
var eventName = firstCon ? "connected" : "reconnected";
self.readyState = 1;
self._reconnect_count = 0;
self._reconnect_incremental_timer = 0;
**
// Set the session ID here
self.sessionId = data.session;
**
var length = self._queue.length;
for (var i=0; i<length; i++) {
self._send(self._queue.shift());
}
self._emit(eventName, data);
// Set up keepalive ping-s
self._ping_interval_handle = setInterval(function () {
var id = uniqueId();
self._send({
msg: "ping",
id: id
});
}, self._ping_interval);
};
This is how it can be done.
https://forums.meteor.com/t/ddp-js-get-connection-id/29136/4