通訊端

sockets 資訊清單屬性會宣告 sockets.udpsockets.tcpsockets.tcpServer API 具備哪些權限。

manifest.json 範例

{
  "name": "My Sockets app",
  "sockets": {
    "udp": {
      // Permission for chrome.sockets.udp.send:
      // The application is allowed to send udp packets
      // to any host:port combination.
      "send": "*"
    },
    "tcp": {
      // Permission for chrome.sockets.tcp.connect:
      // The application is allowed to connect only to the
      // tcp server on 127.0.0.1 port 80.
      "connect": "127.0.0.1:80"
    },
    "tcpServer": {
      // Permission for chrome.sockets.tcpServer.listen:
      // The application is allowed to accept new client
      // connections on the local address at port 80.
      "listen": "127.0.0.1:80"
    }
  },
  ...
}

參考資料

  • udp (物件) - 選用

    udp 資訊清單屬性會宣告應用程式可發出哪些 sockets.udp 作業。

    類型屬性說明
    字串或字串陣列(選用) 受繫結

    bind 運算的 Host:port 模式。

    字串或字串陣列(選用) 傳送

    send 運算的 Host:port 模式。

    字串或字串陣列(選用) 多點傳播會員資格

    joinGroup 運算的 Host:port 模式。

  • tcp (物件) - 選用

    tcp 資訊清單屬性會宣告應用程式可發出的 sockets.tcp 作業。

    類型屬性說明
    字串或字串陣列(選用) 連線

    connect 運算的 Host:port 模式。

  • tcpServer (物件) - 選用

    tcpServer 資訊清單屬性會宣告應用程式可發出的 sockets.tcpServer 作業。

    類型屬性說明
    字串或字串陣列(選用) 監聽

    listen 運算的 Host:port 模式。