Skip to content Skip to sidebar Skip to footer

Why Chrome.sockets.tcp.create() Does Not Work In App Background Script?

I am trying to create a tcp socket in the background script of my app. The error is (first line in 1.js): Uncaught TypeError: Cannot read property 'tcp' of undefined Background s

Solution 1:

You have wrong permissions in manifest. Look up the Chrome API help: https://developer.chrome.com/apps/sockets_tcp (and specificaly for manifest: https://developer.chrome.com/apps/manifest/sockets)

The permissions should read "sockets". You are using the new "sockets" API, but in your manifest you are refering to old "socket" permissions (https://developer.chrome.com/apps/socket)

Your manifest permissions should read:

"permissions":[{"sockets":{"tcp":{"connect":"127.0.0.1:4005"}}}]

Post a Comment for "Why Chrome.sockets.tcp.create() Does Not Work In App Background Script?"