Croupier JavaScript SDKCroupier JavaScript SDK
指南
API 参考
  • C++
  • Go
  • Java
  • Python
Croupier 主项目
GitHub
指南
API 参考
  • C++
  • Go
  • Java
  • Python
Croupier 主项目
GitHub
  • Croupier JavaScript SDK
  • 指南

    • 入门指南
  • API

    • API 参考

入门指南

系统要求

  • Node.js ≥ 22
  • TypeScript ≥ 5.0(可选)

安装

npm install @croupier/sdk

快速开始

TypeScript

import { CroupierClient, ClientConfig } from '@croupier/sdk';

const config: ClientConfig = {
  agentAddr: 'localhost:19090',
  gameId: 'demo-game',
  env: 'development',
  insecure: true,
};

const client = new CroupierClient(config);

client.registerFunction({
  id: 'hello.world',
  version: '0.1.0',
}, async (ctx, payload) => {
  return { success: true };
});

await client.serve();

JavaScript

const { CroupierClient } = require('@croupier/sdk');

const client = new CroupierClient({
  agentAddr: 'localhost:19090',
  gameId: 'demo-game',
  env: 'development',
});

client.registerFunction({
  id: 'hello.world',
  version: '0.1.0',
}, async (ctx, payload) => {
  return { success: true };
});

client.serve();
Edit this page
最近更新: 2026/1/7 23:58
Contributors: cuihairu