---
name: "isP2PActiveSync"
mode: "kit"
versionRequirements:
  - { name: "P2PKit", version: "2.0.3" }
  - { name: "@ray-js/ray", version: "1.3.15" }
platform:
  - "iOS"
  - "Android"
title: "p2p.isP2PActiveSync - Synchronously check the P2P connection"
---

## isP2PActiveSync

> [VERSION] P2PKit >= 2.0.3 | @ray-js/ray >= 1.3.15

> [PLATFORM] iOS, Android

### Description

check P2P status

### Parameters

| Property | Type | Required | Default | Since | Description |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | Yes | - | `2.0.3` | Device ID |
| `mode` | `number` | No | `0` | `2.0.3` | Connection mode, 0: INTERNET  1: LAN |
| `timeout` | `number` | No | `0` | `2.0.3` | Timeout (ms). Defaults: INTERNET 15000 ms, LAN 3000 ms |

### Examples

#### Demo

```tsx
import { p2p } from '@ray-js/ray'

p2p.isP2PActive({
  deviceId: "xx",
  mode: 0,
  timeout: 0,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});
```
