---
name: "onSocketMessageReceived"
mode: "kit"
versionRequirements:
  - { name: "DeviceKit", version: "1.2.6" }
  - { name: "@ray-js/ray", version: "0.6.23" }
platform:
  - "iOS"
  - "Android"
async: true
---

## onSocketMessageReceived

> [VERSION] DeviceKit >= 1.2.6 | @ray-js/ray >= 0.6.23

> [PLATFORM] iOS, Android

> ⚡ **Supports Promise** — Returns a Promise when success / fail / complete callbacks are omitted.

### Description

Socket message channel report

### Parameters

`(listener: Function)`

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| `listener` | `(params: SocketResponse) => void` | Yes | - |  |

### Referenced Types

##### `interface` SocketResponse

| Property | Type | Since | Description |
| --- | --- | --- | --- |
| `message` | `Record<string, Record<string, any>>` | `1.2.6` | Message content |
| `deviceId` | `string` | `1.2.6` | Device ID |
| `type` | `number` | `1.2.6` | LAN message type |


### Examples

#### Basic usage

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

const { onSocketMessageReceived } = device;

onSocketMessageReceived((res) => {
  console.log('onSocketMessageReceived', res);
});
```
