> For the complete documentation index, see [llms.txt](https://dibdbhashini.gitbook.io/api-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dibdbhashini.gitbook.io/api-docs/bhashini-apis/socket/request-payload.md).

# Request Payload

{% tabs %}
{% tab title="Initialize Socket" %}

{% code lineNumbers="true" %}

```json
socket=io(
  "---web socket url---",
{
  transports: [
    "websocket",
    "polling"
  ],
  auth: {
    Authorization: "Socket Authorization Key",
    
  },
  autoConnect: true,
  
});
```

{% endcode %}

**Authorization Token**

* **Name**: `Authorization`
* **Type**: String (Required)
* **Description**: Authentication token for the user.

**Transports**

The socket server supports multiple transports for real-time communication. The server will choose the best available transport method based on the client's capabilities.

* **WebSocket**: Uses the WebSocket protocol for real-time communication. Preferred transport if supported by the client.
* **Polling**: Uses long-polling for real-time communication. Used as a fallback for clients that do not support WebSocket.
  {% endtab %}

{% tab title="Connect" %}

```javascript
socket.on('connect')}
```

{% endtab %}

{% tab title="Emiting Data" %}

{% code lineNumbers="true" %}

```json
socket.emit("data",
[
                      {
                        "audio": [
                          {"audioContent": "PCM AUDIO DATA"}
                        ]
                      },
                      {"responseTaskSequenceDepth": 2},
                      false, // Clear Server Data: Changed from true to false
                      false // Streaming is complete
                    ],

```

{% endcode %}

**Authorization Token**
{% endtab %}
{% endtabs %}
