Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@croquet/croquet
Advanced tools
Croquet lets you build real-time multi-user webapps with only front-end code:
You embed your shared code with the front-end code on your website. Instead of being executed on a server, it is executed simultaneously on each browser. Croquet keeps all those browsers in sync automatically, without you having to deploy anything. All you need is an API key to get access to Croquet's reflector network, which provide that synchronization service.
npm i @croquet/croquet
get a free API key at croquet.io/keys
follow the documentation at croquet.io/docs
Here is our Hello World example which fits on a postcard. You can see it running at croquet.io/postcard21.
Look at the source code on that page! Everything is there.
This is the shared part that will be executed in sync on all browsers:
class Counter extends Croquet.Model {
init() {
this.n = 0;
this.subscribe("counter", "set", this.set);
this.loop();
}
set(value) {
this.n = value;
this.publish("counter", "changed");
}
loop() {
this.set(this.n + 0.1);
this.future(100).loop();
}
}
Counter.register("Counter");
The non-shared part talks to the local DOM:
class Display extends Croquet.View {
constructor(model) {
super(model);
this.model = model;
this.changed();
this.subscribe("counter", "changed", this.changed);
button.onclick = () => this.publish("counter", "set", 0);
}
changed() {
output.innerText = this.model.n.toFixed(1);
}
}
The rest is boiler-plate to show the QR code and join a session:
Croquet.App.messages = true;
Croquet.App.makeWidgetDock();
Croquet.Session.join({
apiKey: 'get your own from croquet.io/keys',
appId: 'io.croquet.postcard21.counter',
name: Croquet.App.autoSession(),
password: Croquet.App.autoPassword(),
model: Counter,
view: Display,
});
That's it!
Croquet picks the reflector with the lowest latency from its global edge reflector fleet for each session, it sends a timing signal to keep all clients in a session synchronized, it distributes pub/sub events to every client, it automatically snapshots and stores the shared model state (securely encrypting it with the session password), it lets new clients join an ongoing session by sending them the latest snapshot, it detects and automatically resumes broken network connections, etc. All without you having to implement or deploy or maintain or scale any servers.
In other words, Croquet takes care of all the things that are not essential to the logic of your multi-user app, so you have more brain cycles left to work on your app. Which as we all know is hard enough, compared to single-user apps.
Happy collaborating!
The Croquet 🦩 Team
FAQs
Multiuser Web Apps and Multiplayer Games without a Server
The npm package @croquet/croquet receives a total of 236 weekly downloads. As such, @croquet/croquet popularity was classified as not popular.
We found that @croquet/croquet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.