<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          web-socket-rubyWeb Socket 的 Ruby 實(shí)現(xiàn)

          聯(lián)合創(chuàng)作 · 2023-09-23 20:21

          這是 Ruby 對(duì) WebSocket 的實(shí)現(xiàn),示例代碼:

            # Runs the server at port 10081. It allows connections whose origin is example.com.
            server = WebSocketServer.new(:port => 10081, :accepted_domains => ["example.com"])
            server.run() do |ws|
              # The block is called for each connection.
              # Checks requested path.
              if ws.path == "/"
                # Call ws.handshake() without argument first.
                ws.handshake()
                # Receives one message from the client as String.
                while data = ws.receive()
                  puts(data)
                  # Sends the message to the client.
                  ws.send(data)
                end
              else
                # You can call ws.handshake() with argument to return error status.
                ws.handshake("404 Not Found")
              end
            end

           

          瀏覽 18
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評(píng)論
          圖片
          表情
          推薦
          點(diǎn)贊
          評(píng)論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  成人污污污网站 | 青青草免费在线看视频 | 影音先锋国男人资源 | 黄色操逼国产 | 欧美色图亚洲色图视频 |