@recon.run/sdk
v0.0.1-alpha.1
Published
Instantly run remote containers.
Downloads
25
Readme
Recon SDK
Instantly run remote containers.
Installation
npm i --save @recon.run/sdk
Usage
Create a new container from a server environment, such as an API endpoint:
import { ReconAdmin } from '@recon.run/sdk/admin';
const recon = new ReconAdmin({
apiKey: 'your-api-key',
});
app.post('/api/container', async () => {
const { jwt } = await recon.createContainer({
size: 'sm',
files: {
'main.dart': 'void main() { \n print("Hello, World!"); \n }',
},
// ... other options
});
return { jwt };
});
Once a container has been created, you can connect to it using the ReconClient
in your client environment:
import { ReconContainer } from '@recon.run/sdk';
// Get the JWT from your server
const { jwt } = await fetch('https://your-app.com/api/container', {
method: 'POST',
}).then((res) => res.json());
// Connect & join to the container
const container = await ReconContainer.join({
jwt,
subscribeFsWatch: true,
// ... other options
});
// Wait for the container to connect
await container.connected;
// Subscribe to container events...
container.onFileSystemTreeChange((tree) => {
console.log('File system tree changed:', tree);
});