nodegin / tglib

TDLib (Telegram Database library) bindings for Node.js
114 stars 16 forks source link

React Native linking #30

Closed jwktje closed 6 years ago

jwktje commented 6 years ago

Apologies if this is a total misunderstanding. But would I be able to use the tdlib with your bindings by linking the library in React Native like mentioned here?

https://facebook.github.io/react-native/docs/linking-libraries-ios.html

The package you wrote works fine on my Node.JS local test application. I want to integrate it into an app with either React Native or Cordova so I wanna know what my options are.

nodegin commented 6 years ago

Hi, I never had experience with linking binaries with RN so I cannot answer your question, but you can try to build and bundle the binary into your RN app and fork tglib to make it load from RN application instead of path maybe? However I don't know if ffi and ref will work fine with RN too... Good luck!

jwktje commented 6 years ago

Good point. I tested it yesterday and it didn't seem to work. Do you think it is possible to use TDLib in any environment like React Native, Cordova, or just straight up client-side JS? Or is this not possible?

nodegin commented 6 years ago

For native, I would suggest you to study the official examples here which integrates TDLib with native, this way should easier to do what you want, or even more, build a RN native extension so you can program in JS, but this basically creating a whole new library 😂

nodegin commented 6 years ago

By the way, the simplest way to do is use tglib from server side, then you write your own API to communicate your app with server, sounds stupid but feasible.