File: test_newapi_wampcra.py

package info (click to toggle)
python-autobahn 22.7.1%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,404 kB
  • sloc: python: 38,356; javascript: 2,705; makefile: 905; ansic: 371; sh: 63
file content (27 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from autobahn.twisted.component import Component, run
from autobahn.wamp import cryptosign
import binascii

privkey_hex = '6e3a302aa67d55ffc2059efeb5cf679470b37a26ae9ac18693b56ea3d0cd331c'
# pubkey: 020b13239ca0f10a1c65feaf26e8dfca6e84c81d2509a2b7b75a7e5ee5ce4b66


component = Component(
    transports='ws://localhost:8080/auth_ws',
    realm='crossbardemo',
    authentication={
        "wampcra": {
            "authid": "username",
            "secret": "p4ssw0rd",
        }
    }
)


@component.on_join
def join(session, details):
    print("Session {} joined: {}".format(details.session, details))


if __name__ == '__main__':
    run(component)