扩展中的 Google Chrome Socket API [英] Google Chrome Socket API in extensions

查看:52
本文介绍了扩展中的 Google Chrome Socket API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,在开发了几个小时的扩展程序后,假设 chrome.socket API 可用于扩展程序,我加载了我的扩展程序,并被告知 Socket API 仅可用于打包应用程序".

So after developing an extension for a few hours, assuming that the chrome.socket API would be available to extensions, I load in my extension and I'm told that the Socket API is only available for 'Packaged Apps'.

有谁知道发生了什么,以及扩展是否会获得该功能(回来了,因为我认为他们在 .experimental 时可以访问)?

Does anyone know what's happening, and whether extensions will get the feature (back, since I think they had access when it was in .experimental)?

推荐答案

来自 Chrome 文档:

打包应用可以充当 TCP 和 UDP 连接的网络客户端.

Packaged apps can act as a network client for TCP and UDP connections.

不,扩展程序无权访问套接字 API,并且他们不可能获得它.

No, extensions do not have access to the socket API, and they aren't likely to ever get it.

您的困惑是可以理解的,因为 Google 所谓的打包应用"过去只不过是在主屏幕上带有图标的美化扩展程序.但是,Google 现在正在扩大扩展程序和应用程序之间的鸿沟.

Your confusion is understandable, since what Google called "packaged apps" used to be nothing but glorified extensions with an icon on the home screen. However, Google is now driving a much wider divide between extensions and apps.

扩展曾经拥有应用程序功能的一个子集,但现在每个扩展都有互斥的功能.扩展程序旨在增强正常的 Web 浏览,而应用程序旨在用作不干扰正常浏览的独立工具.如果您查看 appsextensions,您会看到列表非常不同:应用程序具有强大的硬件 - 并且以操作系统为中心的 API,例如 socketusbbluetooth,而扩展程序垄断了以浏览器为中心的 API,例如 tabscookies书签.

Extensions used to have a subset of the functionality the apps did, but now there is mutually exclusive functionality in each. Extensions are meant for enhancing normal Web browsing, whereas apps are meant to be used as stand-alone tools that do not interfere with normal browsing. If you look at the API lists for apps and for extensions, you'll see that the list is vastly different: apps have the powerful hardware- and OS-centric APIs like socket, usb, and bluetooth, while extensions have a monopoly on browser-centric APIs like tabs, cookies, and bookmarks.

这篇关于扩展中的 Google Chrome Socket API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆