Charles' answer pointed me in the right direction. For those interested in the node.js version, I managed to get it working by using telegram-link module and setting connectionType to TCP:
var telegramLink = require('telegram.link')();
// set the environment
var app = {
// NOTE: if you FORK the project you MUST use your APP ID.
// Otherwise YOUR APPLICATION WILL BE BLOCKED BY TELEGRAM
// You can obtain your own APP ID for your application here: https://my.telegram.org
id: 12345,
hash: 'somehashcode',
version: require('../package.json').version,
lang: 'en',
deviceModel: os.type().replace('Darwin', 'OS_X'),
systemVersion: os.platform() + '/' + os.release(),
connectionType: 'TCP'
};
//var primaryDC = telegramLink.TEST_PRIMARY_DC;
var primaryDC = telegramLink.PROD_PRIMARY_DC;
...
telegramLink.createClient(app, dataCenter, function() {
...
The simple point is, changing it to TCP will give you the desired effect, and you will get the messages pushed to you in registerOnUpdates:
clientProxy.getClient().account.updateStatus(false).then(function() {
clientProxy.getClient().registerOnUpdates(function(update) {
console.log('update', update.toPrintable());
clientProxy.getClient().messages.receivedMessages(update.id, function(err) { console.log(err); });
});
...
Pay attention to receivedMessages - if you don't call this, then Telegram will not send you any new updates. If receivedMessages is not defined in your telegram-link, add the following code to lib/api/messages.js:
// ***
// messages.**receivedMessages(max_id, [callback])**
// Return a Promise to Confirms receipt of messages by a client, cancels PUSH-notification sending.
// [Click here for more details](https://core.telegram.org/method/messages.receivedMessages)
Messages.prototype.receivedMessages = function(max_id, callback) {
return utility.callService(api.service.messages.receivedMessages, this.client, this.client._channel, callback, arguments);
};