7

I am in the process of investigating a Telegram client in C so that I can write a client for the Pebble smartwatch/s. I understand the Pebble side, and all of the Telegram methods shown here, but I have absolutely no clue how to send those in C.

I figure it has something to do with a "TL Language" and the MTProto service, but I think this stuff is beyond my current understanding. I also found this collection of code but again, no clue how to use it https://github.com/vysheng/tgl/.

EDIT 1:

A C-based app with a PebbleKitJS section running on the phone seems like the best route for this. Any help on implementing MTProto with JS?

  • 4
    Those Telegram APIs are Web/HTTP/REST APIs. You'll want to use something like `libcurl` to make those requests. – Jonathon Reinhart May 27 '16 at 21:05
  • You need to narrow this down to a more specific question. Point out exactly what sections of relevant documentation are confusing to you. Try some things out, and ask questions about specific code snippets that you can't get to work. Stack Overflow isn't a good place for "give me some general tips"-style questions. – skrrgwasme May 27 '16 at 22:55
  • @felixjohnson I don't think JavaScript is the way to go for your constrained device... but YES, definitely you schould be able to build a really basic Telegram client in C that might fit your device profile – Charles Okwuagwu Jun 24 '16 at 21:00
  • I found this question having exactly the same intention (to make a Telegram client for Pebble). Have you written any code? I couldn't find any ready application for Pebble, so probably you have some unfinished code. I would be curious to pick it up if you're ok with it. – laughedelic Jun 25 '17 at 21:20
  • @laughedelic I didn't even get off the starting block - it looks like the heavy lifting should be done on the phone in javascript. I've got no clue how to talk to telegram's network over JS – Felix Johnson Jul 17 '17 at 14:01

1 Answers1

9

You have 128KB of RAM on a Pebble, attached to an ARM Cortex M3 or M4.

This means that all your request must fit within 128KB, alongside with an HTTP implementation, an encryption implementation, the respective encryption key and things like whatever you want to keep in memory (contact list, message history, etc).

Frankly, that will not work, and the C programming language is not your problem here, it's that an HTTP-based encrypted protocol is not what you want to run off 128KB RAM.

Since your Pebble has no internet connectivity on its own, you'd need an application running on a smartphone (or any other bluetooth device) that talks to your Pebble – let that be your Telegram client, and just show notifications on your smartwatch.

Marcus Müller
  • 34,677
  • 4
  • 53
  • 94