Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Is there peer-to-peer networking support?

I have an app currently in the planning stage that requires peer-to-peer communication when there is no WIFI or 3G. The iPhone's native GameKit supports this via Bluetooth, however, we really want to be cross-platform with Android.

I see the Networking namespace's Bonjour support, however, this requires a WIFI connection.

Any thoughts?

— asked October 20th 2010 by Todd Schavey
  • mobile
  • multiplayer
  • networking
  • peer-to-peer

3 Answers

  • Did you ever find the answer to this?

    — answered March 19th 2012 by Luke Mackenzie
  • I don't know the details of your app or project but have you considered Bluetooth? Logical Labs has released 2 Bluetooth modules for Titanium in the Appcelerator Marketplace.

    • BT LE iOS module https://marketplace.appcelerator.com/apps/3834?2063287747
    • BT Classic Android module https://marketplace.appcelerator.com/apps/5221?259328472
    — answered March 29th 2013 by John Pataki
  • Hi Todd, to add as a follow up to my post a year ago, I can add some potentially interesting notes for you even if they don't apply exactly to your original challenge:

    • For multiple peer-to-peer connections using 1 of 2 available technologies (BT Classic or WiFi) on iOS,
      we, Logical Labs, recently published our Multipeer Module. We are investigating a possible Android equivalent for at least the WiFi portion of our Multipeer module, contact us directly if are interested in the progress using titanium @ logicallabs.com

    • Depending on the requirements of the app and if you wanted to create a simulated peer-to-peer using Bluetooth, you could "possibly" construct something using Bluetooth LE (BLE) for iOS using the BT LE iOS module I mentioned in my previous answer and separately for Android using BT Classic module however each one would not be able to communicate with each other because they are different protocols and not compatible with each other.

    • On iOS, GameKit and its newer alternative Multipeer use BT Classic and not BLE. Apple restricts access for communicating over BT Classic from an iOS device to a non-MFi certified device. Because of this restriction, you currently can't have Android-to-iOS BT Classic communications.

    • In the time since your post and my answer, Android (as of 4.3) introduced support for BLE to their SDK and we subsequently released an Android BLE module to the marketplace as well. This would theoretically work for very small packet type of communication however there are some significant blocking issues for your cross-platform peer-to-peer challenge:

      1. As of Android 4.4, there is not yet any support in the Android SDK for the "peripheral role" which means that the Android device must always be the "central role". The rumor is that Android 4.5 or 5.x may add support for the "peripheral role". Because of this limitation, you currently can't have Android-to-Android BLE communications.

      2. Also of Android 4.4, there exists in the SDK a bug that prevents successful communication as a "central" communicating with an iOS device as the "peripheral". Because of this bug, you currently can't have Android-to-iOS BLE communications.

      3. If your app design requires streaming or file transfer, then BLE is not really the answer anyway because BLE is designed around small packet transfer whereas BT Classic is equipped to handle streaming solutions.

    I hope this helps clear up some of the challenges with trying to use Bluetooth on iOS and Android. All of the limitations, restrictions and bugs mentioned above are at the native Android or iOS SDK levels and none are because of Titanium or lack of someone producing a Titanium based solution.

    We will be releasing a blog post on our website that will mention some of the same items I do above as well as much more about BT on iOS, Android and Titanium including some tutorials.

    — answered April 11th 2014 by John Pataki
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.