<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>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # :-: 開始使用 ## 說明 * 開發支持全平臺,沒有任何編程語言,服務器限制 * 所有功能通過HTTP協議,使用API的方式完成 * 當前僅完善以下基本功能 * 客戶端:添加/刪除好友,好友申請列表,同意/拒絕申請,好友列表,給好友發消息 * 服務端:發消息給全部用戶,發消息給指定用戶 * 以上功能僅為普通聊天功能,如果可以滿足您的業務,完全可以直接使用系統提供的API完成,無需創建數據庫,不用關心好友關系這些基本邏輯,如果有牽扯復雜的業務邏輯,您可以把該系統當做是一個WebSocket服務系統,僅用來收發消息,業務邏輯在自己服務器實現。 ## 工作原理 1.客戶端使用WebSocket連接服務器,客戶端僅使用WebSocket即時接收消息使用,為了安全考慮,其他功能全部通過API實現; 2.使用API綁定用戶對應客戶端到IM服務器 3.正常使用其他功能接口 ## 接口域名 ``` lufeiim.baomamishu.com ``` ## 開始接入 * 目前僅PHP封裝了接口,其他語言請自行調用,如果有封裝好的,可以聯系我,分享給大家。 PHP封裝的SDK,[下載](http://lufeiim.baomamishu.com/LufeiImLib.zip) ## 客戶端示例代碼 ``` <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Client Test</title> <script language="javascript"type="text/javascript"> var isok=false; websocket = new WebSocket('ws://47.108.188.239:2046/'); //websocket = new WebSocket('ws://127.0.0.1:2046/'); websocket.onopen = function(evt) { console.log('connect'); console.log(evt); //websocket.send('{"data":"helo,word!"}'); }; websocket.onclose = function(evt) { console.log('onclose'); console.log(evt); }; websocket.onmessage = function(evt) { console.log('onmessage'); if (evt.data) { //console.log(JSON.parse(JSON.parse(evt.data))); } }; websocket.onerror = function(evt) { console.log('onerror'); console.log(evt); }; function sendMsg(){ if (!isok){ alert('請先綁定客戶端'); return; } var sendData = { 'data': document.getElementById('name').value,'uid':document.getElementById('uid').value}; websocket.send(JSON.stringify(sendData)); } function bindto(){ var sendData = { 'app_id': document.getElementById('app_id').value, 'uid':document.getElementById('uid').value, 'cmd':'bind' }; websocket.send(JSON.stringify(sendData)); isok=true; } </script> </head> <body> <h2>WebSocket Test</h2> app_id:<input type="text" name="app_id" id="app_id" value="9e17e92d8b58a910"/><br> UID:<input type="text" name="uid" id="uid" /><br> TOID:<input type="text" name="toid" id="toid" /><br> MSG:<input type="text" name="name" id="name" /> <a href="javascript:;" onclick="bindto()">綁定(已廢棄)</a> <a href="javascript:;" onclick="sendMsg()">點擊發送</a> </body> </html> ``` PHP 示例代碼 ``` //引入上面下載的SDK文件 include_once __DIR__.'/../../../'.'LufeiImLib.php'; class LufeiIm { protected $appid='您申請好的APPID'; /** * 綁定到聊天室 * 該接口 每個新用戶首次必須綁定一次 */ public function binding(){ //實例化API庫文件 $lufei=new LufeiImLibClient($this->appid); //調用綁定API接口 $reg=$lufei->binding($roomtoken,$uid); //binding 該接口需要兩個參數,第一個為客戶端連接WebSocket服務器返回的參數 //uid 為您平臺用戶的id(服務器作為您系統的用戶標識,可以不為真實的uid,但后期不能變更) } //......其他API請看下一頁 } ```
                  <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>

                              哎呀哎呀视频在线观看