How to use the cent.core.generate_channel_sign function in cent

To help you get started, we’ve selected a few cent examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github FZambia / centrifuge / examples / tornado_application / main.py View on Github external
def post(self):

        client_id = self.get_argument("client")
        channels = self.get_arguments("channels")

        logging.info("{0} wants to subscribe on {1}".format(client_id, ", ".join(channels)))

        to_return = {}

        for channel in channels:
            info = json.dumps({
                'channel_extra_info_example': 'you can add additional JSON data when authorizing'
            })
            to_return[channel] = {
                "sign": generate_channel_sign(options.project_secret, client_id, channel, info=info),
                "info": info
            }

        # but here we allow to join any private channel and return additional
        # JSON info specific for channel
        self.set_header('Content-Type', 'application/json; charset="utf-8"')
        self.write(json.dumps(to_return))
github synw / django-instant / instant / utils.py View on Github external
def signed_response(channel, client):
    signature = generate_channel_sign(SECRET_KEY, client, channel, info="")
    return {"sign": signature}

cent

Python library to communicate with Centrifugo v5 server HTTP API

Apache-2.0
Latest version published 9 months ago

Package Health Score

71 / 100
Full package analysis