Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including @replit/crosis with all npm packages installed. Try it out:

require("@replit/protocol/package.json"); // @replit/protocol is a peer dependency. var crosis = require("@replit/crosis")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@replit/crosis v2.3.0

Goval connection and channel manager

Run on Repl.it

Generated docs https://replit-crosis--masfrost.repl.co/

Installation

yarn add @replit/crosis @replit/protocol

Crosis relies on the @replit/protocol package as a peer dependency. https://github.com/replit/protocol

Exported

You probably don't need this but it's exported: Channel

Usage

You should probably familiarize yourself with the protocol before trying to use it. Crosis is just a client that helps you connect and communicate with the container using the protocol.

Read about the protocol here http://protodoc.turbio.repl.co

Here's an example of connecting then opening an eval channel and sending it an eval command

import { Client } from '@replit/crosis';

const client = new Client();

const token = await fetch(TOKEN_URL).then((r) => r.text());

await client.connect({ token });

const channel = client.openChannel({
  name: 'evaller',
  service: 'eval',
});

channel.on('cmd', (cmd) => {
  console.log(cmd);
});
channel.send({ eval: '1+1' });

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free