Joh*_*ith 5 javascript google-chrome-app
我尝试启动一个简单的 tcp 服务器:
chrome.sockets.tcpServer.create({}, function(info){
chrome.sockets.tcpServer.listen(info.socketId, 'localhost', 2000, function(result){
console.log(result);
});
});
Run Code Online (Sandbox Code Playgroud)
但不知何故console.log(result);总是打印出来undefined!
http://developer.chrome.com/apps/sockets_tcpServer#method-create
http://developer.chrome.com/apps/sockets_tcpServer#method-listen
我做错了什么?谢谢!
您必须将以下权限添加到清单中:
"sockets": {
"tcpServer" : {
"listen": ["host-pattern1", ...],
...
}
}
Run Code Online (Sandbox Code Playgroud)
https://developer.chrome.com/apps/app_network
| 归档时间: |
|
| 查看次数: |
2613 次 |
| 最近记录: |