---
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 - 检查 P2P 连接同步方法"
---

## isP2PActiveSync

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

> [PLATFORM] iOS, Android

### 描述

check P2P status

### 参数

| 属性 | 类型 | 必填 | 默认值 | 最低版本 | 描述 |
| --- | --- | --- | --- | --- | --- |
| `deviceId` | `string` | 是 | - | `2.0.3` | device id |
| `mode` | `number` | 否 | `0` | `2.0.3` | connect mode,0:INTERNET  1:LAN |
| `timeout` | `number` | 否 | `0` | `2.0.3` | timeout,unit：ms, default as Internet：15000ms,Lan：3000ms |

### 示例代码

#### 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);
  },
});
```
