<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                > 單聊可用于一對一在線聊天、在線客服、系統消息等場景 WS地址:**ws://im.xiangbaicheng.com/chat** 請求方式:**GET** 請求參數: | 參數 | 類型 | 含義 | 取值 | | --- | --- | --- | --- | | token | String | 授權碼 | 通過服務端API獲取,參照[獲取授權碼](https://console.xiangbaicheng.com/doc/token.html "獲取授權碼") | #### 數據格式 | 參數 | 類型 | 含義 | 取值 | | --- | --- | --- | --- | | type | String | 消息類型,single-單聊,group-群聊,join-加群,leave-退群 | 單聊時固定為single | | source | String/Number | 發送者ID或其他唯一字段 | 取值需要具有唯一性 | | target | String/Number | 接收者ID或其他唯一字段 | 取值需要具有唯一性 | | msgType | String | 消息類型,默認text | 支持自定義消息類型,如voice、image、map等 | | extra | Mix | 額外數據,支持任意可解析的格式 | 示例見[額外數據格式示例](https://console.xiangbaicheng.com/doc/single.html#backage "額外數據格式示例") | #### 數據包格式示例 | 參數 | 類型 | 含義 | | --- | --- | --- | | msgId | String/Number | 消息ID | | timestamp | Integer | 發送消息時的時間戳 | #### 發送消息 ``` socket.onopen = function (){ ????// 消息數據包 ????let msgData = { ????????msgId: 1, ????????timestamp: '1611065986' ????} ????// 發送的消息 ????let data = { ????????type: 'single', ????????source: 1, ????????target: 2, ????????msg: msgData ????} ????// 發送消息 ????socket.onopen = function (){ ????????socket.send(data); ????} }; ``` #### 接收消息 ``` socket.onmessage = function (res){ ????// 基于發送消息數據格式進行數據解析 ????let data = JSON.parse(res.data); ????// 其他邏輯處理 }; ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看