1.2.0 • Published 2 years ago

croquet-proxy v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

croquet-proxy

A proxy for the Croquet platform.

How to use

  1. Install Node.js
  2. Create the project directory and navigate to it
  3. Run npm init and follow the instructions
  4. Run npm install croquet-proxy
  5. Define your own Model
// my-model.js
import { Model } from '@croquet/croquet';
class MyModel extends Model {
    init(options) {
        super.init(options);

        // Define your model data always in the 'data' property
        this.data = { counter: 0 }

        this.future(1000).tick()
    }

    tick() {
        this.data.counter++
        this.publish('counter', 'updated')
        this.future(1000).tick()
    }
}
  1. Define the starting point of your application
// my-app.js
import { CroquetProxyServer } from 'croquet-proxy';
import { MyModel } from './my-model.js';
const apiKey = ""
const appId = ""
const name = ""
const password = ""


CroquetProxyServer.start({
    mainModelClass: MyModel,
    allModelClasses: [MyModel],
    apiKey: apiKey,
    appId: appId,
    name: name,
    password: password,
    port: 3000
})
  1. Run node my-app.js
1.2.0

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago