raju
raju

Reputation: 5008

Alternative to chrome native messaging

I want my chrome addon to connect to redis server. One of the option explored is chrome native messaging since addon/browser cannot directly connect to redis. Browser/addon can only communicate through http/websocket.

chrome native messaging seemed to be deprecated and I couldn't find chrome.runtime.connectNative or chrome.runtime.sendNativeMessage mentioned in the current version of browser. I am currently running a web server which can accept http calls from addon and communicate through redis but looking for a faster way.

What can be fastest way for addon to connect to redis?

Edit: I dont intend to publish this addon. I will be only user running this addon but I run this addon on multiple computers running on cloud.

Upvotes: 2

Views: 689

Answers (1)

Rob M.
Rob M.

Reputation: 36541

As @Christopher rightly pointed out, native messaging is not deprecated. In fact, it is supported by pretty much all modern browsers

There is no alternative to native messaging, but I'm not sure that you would necessarily want your users to have to download, install, and configure Redis (which would be required for this to work).

Even though your question doesn't include details about how you are using Redis, I think the Chrome Storage APIs could be helpful, especially since they are just key/value pair storage. You can also use the sync storage if you want data preserved across devices.

If the Storage APIs don't fully cover your needs and you still need Redis, you could also use Chrome Storage as a caching layer between the extension and Redis. In this scenario, your background process would GET and POST data to Redis (via your web server) in the background while the extension only directly utilizes the local storage. This would sacrifice a bit of accuracy (maybe things changed between cached requests) and add a bit of complexity but would speed things up.

Side note: Redis really should not be a performance bottleneck - perhaps you need to scale up your web server or move Redis to a dedicated server/cluster?

Upvotes: 3

Related Questions