Frequently Asked Questions
You will find answers to the most asked questions below in our FAQ.
What is p2pkit?
It is a Software Development Kit (SDK) which enables application developers to integrate proximity-based features into their apps.
How does p2pkit work?
Well, we’re magicians, and like any respectable magician we cannot reveal all of our secrets! Nevertheless, put in a simplified manner, p2pkit utilizes onboard radios (Bluetooth™ and Wi-Fi™) to broadcast and scan for tiny signals which are used to determine when two devices (or more) are in proximity to each other. Please refer to our 'Get Started Guides' for a more comprehensive description of the API.
How does proximity ranging work in p2pkit?
Proximity Ranging adds context to the discovery events by providing 5 levels of proximity strength (from “immediate” to “extremely weak”). You could associate “proximity strength” with distance, but due to the unreliable nature of signal strength (different hardware, environmental conditions, etc.) we preferred not to associate the two. Nevertheless, in many cases you will be able to determine who is the closest peer to you (if he is significantly closer than others).
Upon discovery each peer gets associated with a proximity strength value. p2pkit will keep ranging peers and report any changes to the proximity strength.
There are some limitations: Proximity ranging only works in the foreground. Not all Android devices have the capability to be ranged by other peers. Rate of proximity strength update on Android is significantly slower.
What is the range and performance of p2pkit discoveries?
Whether you’re on a bus or train, at a fair or at the beach, you’ll be able to discover people around you.
Performance: We set ourselves very high standards and are striving to achieve the best of what is possible with the technology currently available. When you enter a conference room or bar, you'll start discovering the closest people around you; however, it can take noticeably more time to discover the person furthest away from you. In the end it's important to remember that discovery is done on a 'best effort basis' and is not 100% guaranteed.
Range: p2pkit is using standard radio technologies (Bluetooth™ and Wi-Fi™) and therefore is theoretically limited to their range.
Can you tell me more about the discovery info?
The discovery info is a payload which you (the developer) can attach to your peer identity. When other peers discover you they receive this payload and can decide to take action. Discovery info is very useful for broadcasting an “intent” to nearby peers or to compliment your identity information. Currently p2pkit supports discovery info with a maximum size of 440 bytes. As the nature of discovery info is “broadcast”, all nearby peers would receive the same version of your discovery info.
A peer can push new discovery info, which will then be propagated to other peers on a best effort basis, however it is hard to predict the exact time when each of the nearby peers would receive the updated version. We've set a limit on how many times you can push new discovery info (one per minute). Considering its “UDP” like nature, discovery info should not be used for messaging or any type of 1 to 1 reliable content exchange between peers.
Please note that discovery info is broadcasted publicly over the air (or over our cloud) and transferred unencrypted. We hence recommend not sending any sensitive data through this means. It is up to you to add any additional safety layer and we highly recommend you to do so.
Can you tell me more about the messaging API?
The messaging API was designed to enable peers to interact with each other following a discovery event, for example you can request a nearby peer to confirm an action. Due to the restrictions mentioned below the API is less suitable for "chat" like functionality.
The messaging API has the following limits: a) each client is throttled to 20msg/s, b) messages can only be sent to currently discovered peers while both are online, c) messages are limited to 100kb in size, d) messages are not end-to-end encrypted.
Can you tell me a bit more about p2pkit discoveries in background?
We do our best so that p2pkit works at all times, including when phones are in the pocket (screen off). It is our mission to stay on top of what’s possible and create the best discovery engine on the market.
Here is a small matrix that explains the exact specs of when discovery should work:
iOS / macOS / Android Active | iOS Non-Active | |
---|---|---|
iOS / macOS / Android Active | Yes | Yes |
iOS Non-Active | Yes | No |
Non-Active user applies to iOS apps which are in the background.
Once 2 users have discovered each other and then transition to a non-active state, they will lose each other either when out of p2p range or/and when timing out (depending on the platform)
Important: Please note that discovery behaviour between older versions of p2pkit may vary. Please make sure to update to the latest version of p2pkit.
Can you tell me a bit more about how lost events work with p2pkit?
p2pkit will notify you when a previously discovered peer is considered lost. This happens, for instance, when the peer moves out of p2p radio range. That said don’t expect to have the "discovery-lost" information in real-time, it will take some time, and for good reasons.
Firstly, wireless connections are by nature shaky and before reporting a peer as “lost”, we double check this is actually the case. This is also to make sure you don’t get false “discovery-lost“ callback events because of a shaky wireless p2p connection, for instance when two peers are at the edge of each other's range.
iOS State Preservation and Restoration
p2pkit can use the CoreBluetooth State Preservation and Restoration API on iOS. State restoration enables p2pkit-enabled apps to continue to discover and be discovered even if the application has crashed or was terminated by the OS. When there is a Bluetooth event relevant to p2pkit, the system will relaunch the app and p2pkit will restore the state and handle the event.
In order for state restoration to work, you would need to startP2PDiscoveryWithDiscoveryInfo:stateRestoration:
and pass in YES
when the application is relaunched.
Important: Please make sure you stopP2PDiscovery
when your end-user no longer wishes to discover or be discovered.
Note: CoreBluetooth State Preservation and Restoration is not available on macOS.
Will it drain users’ battery?
We put a lot of effort into optimizing the battery consumption. p2pkit uses Bluetooth™ and Wi-Fi™ wisely and respects the battery life of you and your users.
When the screen is on and p2pkit is running, the battery consumption is mainly driven by the screen and p2pkit shouldn't add any noticeable battery drain.
In standby mode (screen off), the battery consumption depends on the number of active p2pkit users around you (see also the question above about background discoveries). Nevertheless, our unofficial testing showed ranges from 0.5-1.5 percent per hour (please understand that accurately measuring this is impossible due to the large number of factors that have an impact on battery usage).
A word about p2pkit privacy and security?
As of version 2.0 p2pkit uses randomly generated and short-lived UUIDs to drive discovery. The UUIDs are generated each time the app starts and published publicly over the air for nearby devices to discover each other.
Discovery info is transferred over our cloud, however, it is not end-to-end encrypted. Hence we recommend not sending any sensitive data through this means.
It is up to you to add any additional safety layer and we highly recommend you to do so. For more information please refer to our Terms, License & Policies.
What are the main benefits of p2pkit compared to classical location-based technologies?
p2pkit is like a 6th digital sense able to run without you having to share your location all the time with a remote server.
Location-based services or apps rely on the end-user’s absolute location (e.g. GPS or cell location) sent to a remote server, which matches it with a fixed location (e.g. restaurant) or another end-user (e.g. a date) so that, if there is a match, the end-user can be notified.
The main feature of p2pkit -- peer-to-peer (p2p) discovery -- works differently. It also allows these kinds of matches, just without the need for the end-user’s absolute location.
The main benefits of p2pkit and proximity-based technologies compared to location-based GPS are:
- No need for GPS (and constantly updating your physical location to the cloud)
- Higher accuracy, especially indoors
- De facto proof of discovery since it’s a physical (radio) p2p discovery
- p2pkit consumes less battery
- Works in areas where GPS signals are unreachable (underground) or when moving fast (on the train)
Of course, nothing prevents you from using location-based APIs/frameworks in addition to p2pkit. p2pkit shouldn’t be seen as an alternative: it rather enhances the user experience by adding proximity.
What are the main benefits of p2pkit compared to beacons?
Beacons are cute, but lets face it, we all gotta grow up ;). One of the most notable advantages of p2pkit over beacons is that it doesn’t require any additional hardware, instead, it works directly on the user's smartphone. There is absolutely no need to deploy additional hardware and spend money maintaining it.
Unlike beacons that only offer 1-way communication (beacon → smartphone), p2pkit works directly between the devices and allows users to engage in device-to-device interaction (smartphone ← → smartphone). Because the discovery happens directly between the phones, p2pkit can work on-the-go, outdoors, indoors or basically everywhere your users are.
To break it down to the essentials, p2pkit is:
- Much cheaper than beacons (no hardware, no maintenance)
- Enables devices to communicate directly between each other
- Works both indoors and outdoors
- Consumes less battery
- Works on the go
Do you support x-platform development environments like Cordova/React?
Not officially but it should be a no-brainer to create a bridge/plugin yourself. Our community has already started creating projects exactly for that.
-
You can find a Cordova plugin example here.
Are there any guidelines for using p2pkit within my app?
Although we have optimized p2pkit to run continuously without impacting the battery to much, we recommend enabling p2pkit only when it is relevant for your users and when the circumstances require it. Otherwise we recommend you to disable it.
It is important to note that the first time users use a p2pkit-enabled feature in your app, they will be asked to grant certain permissions. Therefore, try to activate p2pkit only when relevant to the user’s context.
So in short: make it clear to your users what the benefits of your proximity-based features are and only request permissions when relevant to both user and context. Furthermore, please avoid spamming your users with irrelevant discoveries.
Can you tell me more about how App Key validation works?
A validation request is triggered when p2pkit is enabled on a device. The request is sent to our backend to validate the App Key, BundleIDs / Application ID and your account limits. The request result is cached locally and when our backend is not reachable the last known state is used. The request includes additional information as specified in our Privacy Policy and forms the basis for calculating billable events.
Can you tell me more about limits (free/pro)?
p2pkit can impose MAU and App Key limits on your account depending on account type and settings. Free Edition users are subject to default and non editable limits as specified on the pricing page. Pro Edition users can define their own limits via the console. When a MAU Limit is reached, every subsequent and new-to-this-month MAUs Validation Request will fail. For example, end-users that started your app before the limit will be able to use p2pkit also after the limit has been reached. End-users that try to enable p2pkit for the first time after the limit was reached will fail. The MAU limit counts the total MAUs on your account and resets at the beginning of a calendar month. We will notify you via email when your MAU quota has reached 80% and again when it reaches 100%.