# Socket.IO · Waxpeer API

`wss://waxpeer.com/socket.io/?EIO=4&transport=websocket`

Socket.IO is a JavaScript library that enables real-time, bidirectional communication between the server and the client. This guide will walk you through the steps to integrate Waxpeer Socket.IO into your application.

## Authentication

Authentication is supported in two ways:
1. Session based via cookies in headers (`Cookie: _redis=s%3Ayour_session_cookie`)
2. Having Waxpeer API key in header as authorization (`authorization: WAXPEER_KEY`)

## Subscribe and Unsubscribe

Send subscription events to listen for public feeds:
- `csgo`, `rust`, `tf2`, `dota2` (emits `new`, `removed`, `update` events per item)
- `privat_sales` or specific `item_id`
- `inspect`

Example wire messages:
```
42["sub",{"name":"csgo"}]
42["unsub",{"name":"csgo"}]
```

## Game item event

Emits `new`, `removed`, and `update` events per item for games like CS:GO, Rust, TF2, Dota 2.

```json
{
  "event": "update",
  "game": "csgo",
  "name": "AWP | Gungnir (Well-Worn)",
  "float": 0.44339460134506226,
  "price": 7260000,
  "item_id": "34822680618",
  "paint_index": 756,
  "sticker_names": [
    "Sticker | keshandr (Foil) | Krakow 2017"
  ]
}
```

## Change user

Emits object key changes for the authenticated user account (balance, KYC, trade stats).

```json
{
  "wallet": 10000,
  "kyc_status": "requested",
  "no_p2p_until": "2024-01-01T00:00:00Z",
  "failed_trades": 2,
  "failed_row": 2,
  "success_trades": 5
}
```

## Steam trade

Emits Steam trade offer lifecycle updates to both buyer and seller.

```json
{
  "type": "update",
  "data": {
    "id": "10546645",
    "stage": 1,
    "send_until": "2024-02-05T22:21:31.645Z",
    "last_updated": "2024-02-05T22:16:10.709Z",
    "done": false,
    "boxed": "2024-02-05T22:15:36.645Z",
    "costum_id": "710a2b8c-3c24-47e8-9b8b-028b177ff0ed",
    "creator": "seller",
    "now": "2024-02-05T22:16:10.712Z",
    "items": [
      {
        "id": 11491794,
        "price": 2951,
        "name": "StatTrak™ AK-47 | Elite Build (Field-Tested)",
        "status": 0,
        "item_id": 35561226317
      }
    ]
  }
}
```

## Connections

Emits a connection object on create, update, or delete operations (e.g. Discord, Steam OAuth).

```json
{
  "type": "delete",
  "data": null,
  "previous_data": {
    "id": 4,
    "username": "®Suspect4you®",
    "user": "2b4fd250-f1528-4307-904e-c86d7e7c0f65",
    "email": "asdad@hotmail.com",
    "oauth": "discord",
    "bot": "bot1",
    "main": false
  }
}
```

## Notification

Emits real-time notification alerts regarding trades, item delivery, and account notices.

```json
{
  "type": "update",
  "data": {
    "id": 19240228,
    "user": "dadf0f33-3563-441a-9ae0-73c0d1b1954c",
    "action": "sending_steam",
    "message": "Sticker | Heroic | 2020 RMR",
    "parameter": "canceled",
    "read": true,
    "identification": "10375241dadf0f33-3563-441a-9ae0-73c0d1b1954c25707995376",
    "created": "2024-01-18T09:15:33.330Z"
  }
}
```

## Payment

Emits payment transaction updates to track deposits and withdrawals.

```json
{
  "type": "update",
  "data": {
    "id": 727016,
    "status": "completed",
    "transaction_id": null,
    "updated": "2023-12-17T23:05:11.991545-05:00",
    "direction": "out"
  }
}
```
