File: test_newapi5.py

package info (click to toggle)
python-autobahn 17.10.1%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 4,452 kB
  • sloc: python: 22,598; javascript: 2,705; makefile: 497; sh: 3
file content (21 lines) | stat: -rw-r--r-- 557 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from twisted.internet.task import react
from twisted.internet.defer import inlineCallbacks as coroutine
from autobahn.twisted.connection import Connection


@coroutine
def main(reactor, connection):

    transport = yield connection.connect()
    session = yield transport.join(u'realm1')
    result = yield session.call(u'com.example.add2', 2, 3)
    yield session.leave()
    yield transport.disconnect()
    yield connection.close()


if __name__ == '__main__':
    connection = Connection()
    connection.on('start', main)

    react(connection.start)