Skip to content
A JavaScript client that speaks repl.it's container protocol
TypeScript JavaScript HTML
Branch: master
Clone or download
masad-frost Add CHANGELOG
starting at v3
Latest commit 63bd049 Feb 19, 2020
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
src.browser Use parcel for browser bundle Oct 31, 2019
src Always close channels Feb 14, 2020
.editorconfig prettier eslint and the like Sep 21, 2019
.eslintignore
.eslintrc.js Add some breadcrumbs for instrumenting and debugging Oct 10, 2019
.gitignore Use parcel for browser bundle Oct 31, 2019
.prettierrc.js prettier eslint and the like Sep 21, 2019
.replit Add yarn run to run Jan 29, 2020
CHANGELOG.md Add CHANGELOG Feb 19, 2020
LICENSE Create LICENSE Sep 21, 2019
README.md Add spacing Jan 29, 2020
package.json
pull_request_template.md Add pull request template Oct 11, 2019
tsconfig.json Use @replit/protocol instead Oct 14, 2019
yarn.lock Add option to pass in a WebSocket class Jan 29, 2020

README.md

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' });
You can’t perform that action at this time.