Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@remixproject/engine-web

Package Overview
Dependencies
Maintainers
6
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@remixproject/engine-web

The web engine provides a connector for Iframe & Websocket. `npm install @remixproject/engine-web`

latest
Source
npmnpm
Version
0.3.38
Version published
Weekly downloads
237
30.94%
Maintainers
6
Weekly downloads
 
Created
Source

Engine Web

The web engine provides a connector for Iframe & Websocket. npm install @remixproject/engine-web

Iframe

The iframe connector is used to load & connect a plugin inside an iframe. Iframe based plugin are webview using an index.html as entry point & need to use @remixproject/plugin-iframe.

const myPlugin = new IframePlugin({
  name: 'my-plugin',
  url: 'https://my-plugin-path.com',
  methods: ['getData']
})
engine.register(myPlugin);
// This will create the iframe with src="https://my-plugin-path.com"
await manager.activatePlugin('my-plugin');
const data = manager.call('my-plugin', 'getData');

Communication between the plugin & the engine uses the window.postMessage() API.

Websocket

The websocket connector wraps the native Websocket object from the Web API. Websocket based plugin are usually server with a Websocket connection open. Any library can be used, remixproject provide a wrapper around the ws library : @remixproject/plugin-ws.

const myPlugin = new WebsocketOptions({
  name: 'my-plugin',
  url: 'https://my-server.com',
  methods: ['getData']
}, {
  reconnectDelay: 5000 // Time in ms to wait to reconnect after a disconnection 
});
engine.register(myPlugin);
// This will open a connection with the server. The server must be running first.
await manager.activatePlugin('my-plugin');
const data = manager.call('my-plugin', 'getData');

FAQs

Package last updated on 26 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts