问题
I'm looking to build with Twilio's IP Messaging APIs using a cross mobile framework like React Native or Ionic. My question is - is this a sane request? I see that Twilio has a Javascript library that I plan to use. Examples of successes/failures would also help.
My overall goal is to build in simple chat rooms cross platform.
回答1:
If anyone else found their way here from a Google search, I recently released the code I developed to implement IP Messaging on React Native for my org. You can check it out at on GitHub: react-native-twilio-ip-messaging. It currently supports iOS with Android still in beta.
回答2:
The current solution is to implement a native module for Twilio Messaging. Check Twilio's IPM docs for their iOS quickstart. There are too many libraries that the Twilio Node SDK uses that conflict with Apple's JavaScriptCore runtime.
Your native module would communicate with the React Native app through the RN bridge. At a high level you'd have to implement sendMessage/joinChannel
from RN -> iOS and receivedMessage/Channel
from iOS -> RN.
One example (that I've communicated to the Twilio team) is that their JS SDKs break when npm-V8 centric deps like crypto
can't be ported. I'm guessing there are several other basic libraries that are commonplace in Node that don't get ported over by React Native's build system.
You can track related React Native issues here: (Symptom - node modules are missing): https://github.com/facebook/react-native/issues/4968
来源:https://stackoverflow.com/questions/35212841/twilio-on-cross-platform-mobile-tools-ionic-react-native