How can I import socket.io library in chrome extension in manifest version3? - google-chrome

I am currently working on a project to make a chrome extension.
Using the socket.io library in background.js, we are trying to make a feature that allows clients to communicate with each other through extensions.
However, I couldn't find a way to import the socket.io library in manifest version 3.
Is there any way to make this possible in manifest version 3? Or is there any other way to use socket.io in chrome extension?
I tried require() and import method to use socket.io in background.js but it failed.
I put socketio "dependencies" in manifest.json file but I'm not sure it's working.
Also, I copy and pasted socket.io.js code inside the background.js to mock importing library but it also failed.

Related

How to bundle a Native Host with Chrome Extension and publish it?

I'm publishing a Chrome Extension that uses Native Messaging with a java application but it says that i cannot upload a double manifest ( one for the extension, the other one for the native host installation).
The only solution that i thought is to include the manifest of the java app inside the extension manifest (but i'm not sure it's possible, could you confirm please) OR to upload somewhere else the native host app (including its manifest) and let the user to download and install it. Is there another way?
Chrome extensions cannot include additional software which runs outside Chrome, like native host apps.
You will need to distribute your Java application (and its associated application manifest) separately from the Chrome extension.
You can't include multiple manifest files.
For native message host, please try to refer this link
https://developer.chrome.com/apps/nativeMessaging#native-messaging-host

How to do File IO using chrome extension?

I am developing a chrome extension which needs to append to a file in local directory.
This extension is for internal purpose only.
Using chrome app is not a feasible solution as they are getting deprecated.

Not able to load images and json files locally in react js with HTTPS=true in react app

I have created a react app using create-react-app and running it using command
set HTTPS=true&&npm start. Also, I'm using the axios for AJAX call.
In the app, I want to use the mock data from the JSON files which are in the local directory under the src/shared/mockdata folder but somehow I'm getting the 404 error/ Cannot GET /assets/logo-80x80.png though I have given the full path https://localhost:3000/shared/mockdata/current.json and this same thing is happening with loading the images as well.
I used npm run eject and tried it by setting the value false of disableDotRule of histodisableDotRuleryApiFallback in webpackDevserver.config.js file.

How to explore Google Endpoint API hosted over HTTP without generating google chrome files in my project folder?

I am testing my Google Endpoint API over localhost. And to test the api locally, I am following this command suggested from google- (https://developers.google.com/explorer-help/#hitting_local_api)
"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\Users\Probhat\workspace\codesap" --unsafely-treat-insecure-origin-as-secure=http://localhost:8888
It is working fine. I can access the API's. But the main problem here is that the command itself generating some extra files in my project folder. And the files are very irritating while developing the project.
Earlier I can easily load the api's just clicking "Load Unsafe Scripts". It did not generate the chrome files. But this is not working now.
I want to know is there any way to test the API's in Chrome without generating those files?

Does Dart support the W3C File API standard?

I wrote a Dart web app that compiles to Javascript (dart2js), which I package in an APK (PhoneGap) and run as an Android app. I want my app to backup and restore its data from the local file system.
W3C has a File API standard for file IO within a web browser:
http://www.w3.org/TR/FileAPI/#introduction.
A popular HTML5 learning website has an article showing how to use the W3C File API:
http://www.html5rocks.com/en/tutorials/file/dndfiles/
I tried to use Dart's dart:io library to write to a file from a web page, but got this error:
Failed to load a file dart:io
Failed to load resource
dart:io
I'm not sure what caused this error. Maybe dart:io doesn't run in a browser. Maybe dart:io has an undocumented pubspec dependency (I didn't see any dart:io examples that declare its dependencies.)
If you know how to read/write files in a web browser using Dart, please explain how to do it.
Thanks
dart:io is a Server library, you have to use File from dart:html.