Socket support with chrome extensions

1,196 views
Skip to first unread message

Johnny Bx

unread,
Jun 24, 2021, 3:58:57 AM6/24/21
to Chromium Extensions
Hi,

I want to create a chrome extension that will expose the current tab and url opened by chrome. I should be able to query this extension from any external app (nodejs server for ex) and I expected to use socket.
The chrome extension will play the role of the server and I will send request from the external applications to get the current tab.
By checking the chrome documentation I am really confuse if I can use chrome.socket.udp or chrome.socket.tcp or even chrome.socket.tcpserver from an extension or is it limited to apps? Is websocket is supported?  
Looks like others are using socket.io (https://stackoverflow.com/questions/31061673/chrome-extension-socket-io-node-js) but this example is actually the opposite because the extension consumes data and the server is the external app.
I need a bit of guidance to take the right decision because everything I've tried so far, doesn't work. I am sure that I will be facing to other issues afterward (CORS....) but I will fix that at the right moment.

Thanks in advance.

Jackie Han

unread,
Jun 24, 2021, 10:58:25 AM6/24/21
to Johnny Bx, Chromium Extensions
chrome.socket.* can't be used in extension. But Native Messaging seems to work in extension.

--
You received this message because you are subscribed to the Google Groups "Chromium Extensions" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-extens...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-extensions/42838f17-8dc6-4145-a314-7b002ebe07dbn%40chromium.org.

Johnny Bx

unread,
Jun 25, 2021, 2:53:51 AM6/25/21
to Chromium Extensions, Jackie Han
Thanks. I will check how I can interact with native messages from an external source.
Reply all
Reply to author
Forward
0 new messages