本页面是 Chrome 应用平台文档(已于 2020 年弃用)的一部分。至少在 2025 年 1 月之前,使用 ChromeOS 的企业版和教育版客户仍可使用该功能。详细了解如何
迁移应用 。
套接字
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
重要提示 :Chrome 将在所有平台上取消对 Chrome 应用的支持。Chrome 浏览器和
Chrome 应用商店将继续支持扩展程序。阅读公告 ,学习相关知识
详细了解如何迁移应用 。
sockets
清单属性声明了适用于 sockets.udp 的权限,
sockets.tcp 和 sockets.tcpServer API。
manifest.json 示例
{
"na me ": "My Socke ts app ",
"socke ts ": {
"udp ": {
// Permission for chrome.sockets.udp.send:
// The application is allowed to send udp packets
// to any host:port combination.
"se n d ": "* "
},
"t cp ": {
// Permission for chrome.sockets.tcp.connect:
// The application is allowed to connect only to the
// tcp server on 127.0.0.1 port 80.
"co nne c t ": "127.0.0.1 : 80 "
},
"t cpServer ": {
// Permission for chrome.sockets.tcpServer.listen:
// The application is allowed to accept new client
// connections on the local address at port 80.
"lis ten ": "127.0.0.1 : 80 "
}
},
...
}
参考
udp
(对象) - 可选
udp
清单属性声明应用可以发出哪些 sockets.udp 操作。
类型 属性 说明 字符串或字符串数组 (可选)绑定
bind
操作的 host:port 模式。
字符串或字符串数组 (可选)发送
send
操作的 host:port 模式。
字符串或字符串数组 (可选)multicastMembership
joinGroup
操作的 host:port 模式。
tcp
(对象) - 可选
tcp
清单属性声明应用可以发出哪些 sockets.tcp 操作。
类型 属性 说明 字符串或字符串数组 (可选)关联
connect
操作的 host:port 模式。
tcpServer
(对象) - 可选
tcpServer
清单属性声明应用可以发出哪些 sockets.tcpServer 操作。
类型 属性 说明 字符串或字符串数组 (可选)收听
listen
操作的 host:port 模式。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可 获得了许可,并且代码示例已根据 Apache 2.0 许可 获得了许可。有关详情,请参阅 Google 开发者网站政策 。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2014-01-08。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"没有我需要的信息"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"太复杂/步骤太多"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"内容需要更新"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"示例/代码问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]
{"lastModified": "\u6700\u540e\u66f4\u65b0\u65f6\u95f4 (UTC)\uff1a2014-01-08\u3002"}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2014-01-08。"],[],[]]