0.13.6 • Published 3 months ago

gamixlabs_colyseus_social_custom v0.13.6

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Features

  • Authenticate with Facebook
  • Get list of user's friends
  • Get list of user's online friends
  • Friend requests (send, accept, decline)
  • Block user
  • Remove friend

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

  • Anonymous
  • Facebook
  • ...more coming soonish!

Environment Variables

  • MONGO_URI: MongoDB connection URI
  • JWT_SECRET: Secure secret string for authentication.

For Facebook:

  • FACEBOOK_APP_TOKEN: Facebook App Token ("appid|appsecret")

For Push Notifications

  • WEBPUSH_SUBJECT - mailto: or URL.
  • WEBPUSH_PUBLIC_KEY - VAPID Public Key
  • WEBPUSH_PRIVATE_KEY - VAPID Private Key

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.

0.13.6

3 months ago

0.13.5

3 months ago

0.13.0

10 months ago

0.13.1

10 months ago

0.13.2

10 months ago

0.13.3

10 months ago

0.13.4

9 months ago

0.12.0

12 months ago

0.11.62

1 year ago

0.11.63

1 year ago

0.11.64

1 year ago

0.11.61

2 years ago

0.11.60

2 years ago

0.11.59

2 years ago

0.11.58

2 years ago

0.11.57

2 years ago

0.11.56

2 years ago

0.11.55

2 years ago