---
# System prepended metadata

title: 電子視訊API文件 (v1.2)

---

# 電子視訊API文件 (v1.2)

[TOC]

---

## Socket URL

### URL 1:
wss://ws8001.rvfly.com

### URL 2(備用):
wss://ws8002.rvfly.com

---

## 指令說明

|       指令       | 說明                                                                                    |
|:----------------:|:--------------------------------------------------------------------------------------- |
| gls2gsOpenTable  | 例行維護完，開桌                                                                        |
| gls2gsCloseTable | 關桌，進行例行維護                                                                      |
|    tlsNewGame    | 新局開始的起始點，會開始倒數秒數                                                        |
|    tlsUptime     | 倒數結束的時間點，一個時間點的通知點，代表下注時間已過                                  |
|   tlsOpenCard    | 停止下注後，正在翻牌中                                                                  |
|  tlsShowWinner   | 結果計算完畢，開始派彩動作                                                              |
|   tlsGameIdle    | 此局結束                                                                                |
|  tlsDealerLogin  | 荷官登入此桌指令，會即時更新dealer內資訊                                                |
| tlsDealerLogout  | 荷官登出此桌指另，登出後dealer會變成null                                                |
|    tlsShuffle    | 洗牌指令，遊戲正在進行洗牌                                                              |
|  tlsCancelGame   | 此局取消指令，新局開始與派彩之間發生錯誤或不如預期情況，督導 評估後才回執行取消本局指令 |

---

## 指令時序
1. gls2gsOpenTable
2. tlsDealerLogin
3. tlsShuffle
4. **tlsNewGame**
5. **tlsUptime**
6. **tlsOpenCard**
7. **tlsShowWinner**
8. **tlsGameIdle**
9. tlsDealerLogout
10. gls2gsCloseTable

**PS: 4 ~ 8 為每局時序**

---

## 欄位資料說明

|      欄位      | 說明                                                     |
|:--------------:|:-------------------------------------------------------- |
|    tableKey    | 實體桌的桌號                                             |
|   gameRound    | 每局唯一的局號                                           |
|    gameType    | 遊戲玩法分類                                             |
|      deck      | 靴號                                                     |
|     round      | 同一靴裡的局號(counter)                                  |
|    betTime     | 此桌的下注時間(millisecond)                              |
| startTimeStamp | 開始下注的timestamp(13位數)                              |
|   betEndTime   | 停止下注的timestamp(13位數)                              |
|     status     | 狀態(new_game、open_cards、show_winner、shuffling、idle) |
|   timestamp    | 指令發送的timestamp(13位數)                              |
|     dealer     | 荷官的個人資料                                           |

---

## 各指令資料範例

### gls2gsOpenTable

```json=
// Data for JSON
{
  "cmd"       : "gls2gsOpenTable",
  "tableKey"  : "a001sF01",
  "status"    : "open",
  "timestamp" : 1585210003182
}
```

### gls2gsCloseTable

```json=
// Data for JSON
{
  "cmd": "gls2gsCloseTable",
  "tableKey": "a001sF01",
  "status": "close",
  "timestamp": 1585210003182
}
```

### tlsNewGame

```json=
// Data for JSON
{
  "cmd": "tlsNewGame",
  "tableKey": "a001sF01",
  "gameRound": "840aa001200330100226a10010664",
  "gameType": "a1",
  "deck": 12,
  "round": 1,
  "betTime": 18000,
  "startTimeStamp": 1585534180268,
  "betEndTime": 1585534199268,
  "status": "new_game",
  "timestamp": 1585534180316,
  "dealer": {
    "pid": 59,
    "lobbyKey": null,
    "firstName": "",
    "lastName": "",
    "gender": "Female",
    "birthday": "",
    "country": null,
    "idNumber": "A123456759",
    "idType": null,
    "state": "Taiwan ",
    "city": "Taipei",
    "address": "",
    "phone": "",
    "displayName": "",
    "height": null,
    "weight": null,
    "cup": "A",
    "bust": null,
    "waist": null,
    "hip": null,
    "email": "",
    "imType": "",
    "imId": "",
    "enrollDate": "2019/8/12",
    "status": "On-Line",
    "photo": "m_no59.jpg",
    "video": "m_no59.mp4",
    "loginId": "59",
    "previousAction": "login",
    "previousTime": 1585533563
  }
}
```

### tlsUptime

```json=
// Data for JSON
{
  "cmd": "tlsUptime",
  "tableKey": "a001sF01",
  "gameRound": "840aa001200330100226a10010664",
  "betEndTime": 1585534199268,
  "status": "new_game",
  "timestamp": 1585534199310
}
```

### tlsOpenCard

```json=
// Data for JSON
{
  "cmd": "tlsOpenCard",
  "tableKey": "a001sF01",
  "gameRound": "840aa001200330100226a10010664",
  "status": "open_cards",
  "cardInfo": [
    {
      "index": 1,
      "suit": "clubs",
      "point": 13,
      "type": "player",
      "status": "open"
    },
    ...
    {
      "index": 6,
      "suit": "clubs",
      "point": 8,
      "type": "banker",
      "status": "open"
    }
  ],
  "timestamp": 1585534208981
}
```

### tlsShowWinner

```json=
// Data for JSON
{
  "cmd": "tlsShowWinner",
  "tableKey": "a001sF01",
  "gameRound": "840aa001200330100226a10010664",
  "status": "show_winner",
  "timestamp": 1585534210996,
  "gameResult": {
    // 開牌資料 object
  },
  "gameHistory": [
    // 各局路單資料 array object
  ]
}
```

### tlsGameIdle

```json=
// Data for JSON
{
  "cmd": "tlsGameIdle",
  "tableKey": "a001sF01",
  "gameRound": "840aa001200330100226a10010664",
  "status": "idle",
  "timestamp": 1585534310733
}
```

### tlsDealerLogin

```json=
// Data for JSON
{
  "cmd": "tlsDealerLogin",
  "tableKey": "a001sF01",
  "status": "idle",
  "timestamp": 1585534475065,
  "dealer": {
    "pid": 77,
    "lobbyKey": null,
    "firstName": "",
    "lastName": "",
    "gender": "Female",
    "birthday": "",
    "country": null,
    "idNumber": "A123456777",
    "idType": null,
    "state": "Taiwan",
    "city": "Taipei",
    "address": "",
    "phone": "",
    "displayName": "雯雯",
    "height": null,
    "weight": null,
    "cup": "A",
    "bust": null,
    "waist": null,
    "hip": null,
    "email": "",
    "imType": "",
    "imId": "",
    "enrollDate": "2019/10/8",
    "status": "On-Line",
    "photo": "m_no77.jpg",
    "video": "m_no77.mp4",
    "loginId": "77",
    "previousAction": "login",
    "previousTime": 1585534475
  }
}
```

### tlsDealerLogout

```json=
// Data for JSON
{
  "cmd": "tlsDealerLogout",
  "tableKey": "a001sF01",
  "status": "idle",
  "timestamp": 1585534448458
}
```

### tlsShuffle

```json=
// Data for JSON
{
  "cmd": "tlsShuffle",
  "tableKey": "a001sF01",
  "status": "shuffling",
  "timestamp": 1585534039133
}
```

### tlsCancelGame

```json=
// Data for JSON
{
  "cmd":"tlsCancelGame",
  "tableKey": "a001sF01",
  "gameRound": "840aa001200326181247a10011201",
  "status": "idle",
  "timestamp": 1585278593498
}
```

---

## 百家樂 相關資料說明

| 桌號(tableKey) |      說明       |
|:--------------:|:---------------:|
|    a001sF01    | 脫衣百家樂 1 桌 |
|    a001sF02    | 脫衣百家樂 2 桌 |
|    a001sF03    | 脫衣百家樂 3 桌 |
|    a001sF04    | 天王百家樂 4 桌 |
|    a001sF05    | 天王百家樂 5 桌 |
|    a001sF06    | 天王百家樂 6 桌 |
|    a001sF07    | 音速百家樂 1 桌 |
|    a001sF08    | 音速百家樂 2 桌 |
|    a001sF09    | 音速百家樂 3 桌 |

|    欄位     |      說明      |
|:-----------:|:--------------:|
|  cardInfo   |     array      |
|    index    |    開牌順序    |
|    suit     |      花色      |
|    point    |      點數      |
|    type     |    莊 or 閑    |
|   status    | open or close  |
| gameResult  |     object     |
|   winner    | 贏家(莊 or 閑) |
| playerPoint | 閑家點數(0-9)  |
| bankerPoint | 莊家點數(0-9)  |
| playerPair  | 閑家對子(0-9)  |
| bankerPair  | 莊家對子(0-9)  |

---

## 色牒 相關資料說明

| 桌號(tableKey) |   說明    |
|:--------------:|:---------:|
|    a001sM01    | 色牒 1 桌 |
|    a001sM02    | 色牒 2 桌 |
|    a001sM03    | 色牒 3 桌 |
|    a001sM04    | 色牒 4 桌 |

| 欄位  |           說明            |
|:-----:|:-------------------------:|
| ball1 | 第 1 球顏色(red or white) |
| ball2 | 第 2 球顏色(red or white) |
| ball3 | 第 3 球顏色(red or white) |
| ball4 | 第 4 球顏色(red or white) |

---