colyseus / colyseus-social

Authentication and Social features
https://docs.colyseus.io/tools/colyseus-social/
MIT License
21 stars 17 forks source link
colyseus colyseus-plugin facebook


Discussion forum

Authentication and Social features for Colyseus
View documentation

Features

Hooks

import { hooks } from "@colyseus/social";

hooks.beforeAuthenticate((provider, $setOnInsert, $set) => {
    // assign default metadata upon registration
    $setOnInsert = {
        metadata: {
            coins: 100,
            trophies: 0
        }
    };
});

hooks.beforeUserUpdate((_id, fields) => {
    if (fields['username']) {
        if (fields['username'] === "bad word!") {
            throw new Error("can't have bad words!");
        }
    }
})

Authentication Providers

Environment Variables

For Facebook:

For Push Notifications

You can generate VAIPD keys using npx web-push generate-vapid-keys

Integration with your Node.js Web Framework

Express

import express from "express";
import socialRoutes from "@colyseus/social/express"

const app = express();
app.use("/", socialRoutes);

app.listen(8080);

TODO's

License

MIT License.