# 获取打印机列表

# 请求示例

const ws = new WebSocket('ws://127.0.0.1:12705');
ws.onopen = () => {
    console.log('与打印组件建立连接成功: ');
    ws.send(JSON.stringify({
        requestID: '1234',
        command: 'getPrinterList'
    }))
};

ws.onmessage = (e) => {
    const resp = JSON.parse(e.data || '{}')
    if (resp.command === 'getPrinterList') {
        console.log('打印机列表: ', resp.printerList);
    }
};

# 返回参数示例

{
  "command": "getPrinterList",
  "requestID": "1234",
  "printerList": [{
      "name": "_KM_202_NEW_",
      "displayName": "KM-202(NEW)",
      "status": 3
  }],
}