Socket
Socket
Sign inDemoInstall

dcl-node-runtime

Package Overview
Dependencies
11
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    dcl-node-runtime

It is meant to run from a host application like this:


Version published
Maintainers
1
Install size
3.91 MB
Created

Readme

Source

Node runtime for decentraland scenes

It is meant to run from a host application like this:

function setDebugRunner(wss: WebSocket.Server) {
  wss.on("connection", (ws) => {
    if (ws.protocol == "dcl-scene") {
      // dist/index.js
      const file = require.resolve("dcl-node-runtime");

      const fork = childProcess.fork(file, [], {
        // enable two way IPC
        stdio: [0, 1, 2, "ipc"],
        cwd: process.cwd(),
      });

      console.log(`> Creating scene fork #` + fork.pid);

      fork.on("close", () => {
        if (ws.readyState == ws.OPEN) {
          ws.close();
        }
      });
      fork.on("message", (message) => {
        if (ws.readyState == ws.OPEN) {
          ws.send(message);
        }
      });
      ws.on("message", (data) => fork.send(data.toString()));
      ws.on("close", () => {
        console.log("> Killing fork #" + fork.pid);
        fork.kill();
      });
    }
  });
}

FAQs

Last updated on 07 Oct 2020

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc