rename
This commit is contained in:
@@ -66,110 +66,110 @@ server:
|
||||
|
||||
|
||||
server_with_rpc_timeservice_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.timeservice.TimeServiceBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.timeservice.backend.Component"
|
||||
|
||||
client_rpc_timeservice_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.timeservice.TimeServiceFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.timeservice.frontend.Component"
|
||||
|
||||
client_rpc_timeservice_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.timeservice.TimeServiceBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.timeservice.backend.Component"
|
||||
|
||||
|
||||
server_with_rpc_arguments_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.arguments.ArgumentsBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.arguments.backend.Component"
|
||||
|
||||
client_rpc_arguments_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.arguments.ArgumentsFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.arguments.frontend.Component"
|
||||
|
||||
client_rpc_arguments_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.arguments.ArgumentsBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.arguments.backend.Component"
|
||||
|
||||
|
||||
server_with_rpc_options_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.rpcoptions.RpcOptionsBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.options.backend.Component"
|
||||
|
||||
client_rpc_options_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.rpcoptions.RpcOptionsFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.options.frontend.Component"
|
||||
|
||||
client_rpc_options_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.rpcoptions.RpcOptionsBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.options.backend.Component"
|
||||
|
||||
|
||||
server_with_rpc_errors_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.errors.ErrorsTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.errors.backend.Component"
|
||||
|
||||
client_rpc_errors_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.errors.ErrorsTestFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.errors.frontend.Component"
|
||||
|
||||
client_rpc_errors_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.errors.ErrorsTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.errors.backend.Component"
|
||||
|
||||
|
||||
server_with_rpc_complex_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.complex.ComplexBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.complex.backend.Component"
|
||||
|
||||
client_rpc_complex_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.complex.ComplexFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.complex.frontend.Component"
|
||||
|
||||
client_rpc_complex_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.complex.ComplexBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.complex.backend.Component"
|
||||
|
||||
|
||||
server_with_rpc_progress_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.progress.ProgressiveBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "rpc.progress.backend.Component"
|
||||
|
||||
client_rpc_progress_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.progress.ProgressiveFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.progress.frontend.Component"
|
||||
|
||||
client_rpc_progress_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.progress.ProgressiveBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "rpc.progress.backend.Component"
|
||||
|
||||
|
||||
server_with_pubsub_basic_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.pubsub.PubSubTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.basic.backend.Component"
|
||||
|
||||
client_pubsub_basic_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.pubsub.PubSubTestFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.basic.frontend.Component"
|
||||
|
||||
client_pubsub_basic_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.pubsub.PubSubTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.basic.backend.Component"
|
||||
|
||||
|
||||
server_with_pubsub_complex_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.complexevent.ComplexEventTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.complex.backend.Component"
|
||||
|
||||
client_pubsub_complex_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.complexevent.ComplexEventTestFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.complex.frontend.Component"
|
||||
|
||||
client_pubsub_complex_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.complexevent.ComplexEventTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.complex.backend.Component"
|
||||
|
||||
|
||||
server_with_pubsub_options_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.pubsuboptions.PubSubOptionsTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.options.backend.Component"
|
||||
|
||||
client_pubsub_options_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.pubsuboptions.PubSubOptionsTestFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.options.frontend.Component"
|
||||
|
||||
client_pubsub_options_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.pubsuboptions.PubSubOptionsTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.options.backend.Component"
|
||||
|
||||
|
||||
server_with_pubsub_unsubscribe_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.unsubscribe.UnsubscribeTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "pubsub.unsubscribe.backend.Component"
|
||||
|
||||
client_pubsub_unsubscribe_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.unsubscribe.UnsubscribeTestFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.unsubscribe.frontend.Component"
|
||||
|
||||
client_pubsub_unsubscribe_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.unsubscribe.UnsubscribeTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "pubsub.unsubscribe.backend.Component"
|
||||
|
||||
|
||||
server_with_session_series_backend:
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "session.series.SeriesTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python server.py --component "session.series.backend.Component"
|
||||
|
||||
client_session_series_frontend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "session.series.SeriesTestFrontend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "session.series.frontend.Component"
|
||||
|
||||
client_session_series_backend:
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "session.series.SeriesTestBackend"
|
||||
PYTHONPATH=../../../../autobahn python client.py --component "session.series.backend.Component"
|
||||
|
||||
42
examples/twisted/wamp/basic/pubsub/basic/backend.py
Normal file
42
examples/twisted/wamp/basic/pubsub/basic/backend.py
Normal file
@@ -0,0 +1,42 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.twisted.util import sleep
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes an event every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
counter = 0
|
||||
while True:
|
||||
self.publish('com.myapp.topic1', counter)
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
@@ -24,26 +24,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class PubSubTestBackend(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes an event every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
counter = 0
|
||||
while True:
|
||||
self.publish('com.myapp.topic1', counter)
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
|
||||
|
||||
|
||||
class PubSubTestFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that subscribes and receives events,
|
||||
and stop after having received 5 events.
|
||||
17
examples/twisted/wamp/basic/pubsub/complex/__init__.py
Normal file
17
examples/twisted/wamp/basic/pubsub/complex/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
51
examples/twisted/wamp/basic/pubsub/complex/backend.py
Normal file
51
examples/twisted/wamp/basic/pubsub/complex/backend.py
Normal file
@@ -0,0 +1,51 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
import random
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.wamp.types import SubscribeOptions
|
||||
from autobahn.twisted.util import sleep
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes events with no payload
|
||||
and with complex payloads every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
counter = 0
|
||||
while True:
|
||||
self.publish('com.myapp.heartbeat')
|
||||
|
||||
obj = {'counter': counter, 'foo': [1, 2, 3]}
|
||||
self.publish('com.myapp.topic2', random.randint(0, 100), 23, c = "Hello", d = obj)
|
||||
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
@@ -27,32 +27,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class ComplexEventTestBackend(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes events with no payload
|
||||
and with complex payloads every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
counter = 0
|
||||
while True:
|
||||
self.publish('com.myapp.heartbeat')
|
||||
|
||||
obj = {'counter': counter, 'foo': [1, 2, 3]}
|
||||
self.publish('com.myapp.topic2', random.randint(0, 100), 23, c = "Hello", d = obj)
|
||||
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
|
||||
|
||||
|
||||
class ComplexEventTestFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that subscribes and receives events
|
||||
of no payload and of complex payload, and stops after 5 seconds.
|
||||
17
examples/twisted/wamp/basic/pubsub/options/__init__.py
Normal file
17
examples/twisted/wamp/basic/pubsub/options/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
45
examples/twisted/wamp/basic/pubsub/options/backend.py
Normal file
45
examples/twisted/wamp/basic/pubsub/options/backend.py
Normal file
@@ -0,0 +1,45 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.wamp.types import PublishOptions, EventDetails, SubscribeOptions
|
||||
from autobahn.twisted.util import sleep
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes an event every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
counter = 0
|
||||
while True:
|
||||
publication = yield self.publish('com.myapp.topic1', counter,
|
||||
options = PublishOptions(acknowledge = True, discloseMe = True))
|
||||
print("Event published with publication ID {}".format(publication.id))
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
@@ -25,28 +25,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class PubSubOptionsTestBackend(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes an event every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
counter = 0
|
||||
while True:
|
||||
publication = yield self.publish('com.myapp.topic1', counter,
|
||||
options = PublishOptions(acknowledge = True, discloseMe = True))
|
||||
print("Event published with publication ID {}".format(publication.id))
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
|
||||
|
||||
|
||||
class PubSubOptionsTestFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that subscribes and receives events,
|
||||
and stop after having received 5 events.
|
||||
17
examples/twisted/wamp/basic/pubsub/unsubscribe/__init__.py
Normal file
17
examples/twisted/wamp/basic/pubsub/unsubscribe/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
43
examples/twisted/wamp/basic/pubsub/unsubscribe/backend.py
Normal file
43
examples/twisted/wamp/basic/pubsub/unsubscribe/backend.py
Normal file
@@ -0,0 +1,43 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.twisted.util import sleep
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes an event every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
counter = 0
|
||||
while True:
|
||||
self.publish('com.myapp.topic1', counter)
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
@@ -24,27 +24,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class UnsubscribeTestBackend(ApplicationSession):
|
||||
"""
|
||||
An application component that publishes an event every second.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
counter = 0
|
||||
while True:
|
||||
self.publish('com.myapp.topic1', counter)
|
||||
counter += 1
|
||||
yield sleep(1)
|
||||
|
||||
|
||||
|
||||
class UnsubscribeTestFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component that subscribes and receives events.
|
||||
After receiving 5 events, it unsubscribes, sleeps and then
|
||||
57
examples/twisted/wamp/basic/rpc/arguments/backend.py
Normal file
57
examples/twisted/wamp/basic/rpc/arguments/backend.py
Normal file
@@ -0,0 +1,57 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component providing procedures with
|
||||
different kinds of arguments.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def ping():
|
||||
return
|
||||
|
||||
def add2(a, b):
|
||||
return a + b
|
||||
|
||||
def stars(nick = "somebody", stars = 0):
|
||||
return "{} starred {}x".format(nick, stars)
|
||||
|
||||
def orders(product, limit = 5):
|
||||
return ["Product {}".format(i) for i in range(50)][:limit]
|
||||
|
||||
def arglen(*args, **kwargs):
|
||||
return [len(args), len(kwargs)]
|
||||
|
||||
self.register(ping, 'com.arguments.ping')
|
||||
self.register(add2, 'com.arguments.add2')
|
||||
self.register(stars, 'com.arguments.stars')
|
||||
self.register(orders, 'com.arguments.orders')
|
||||
self.register(arglen, 'com.arguments.arglen')
|
||||
@@ -23,42 +23,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class ArgumentsBackend(ApplicationSession):
|
||||
"""
|
||||
An application component providing procedures with
|
||||
different kinds of arguments.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def ping():
|
||||
return
|
||||
|
||||
def add2(a, b):
|
||||
return a + b
|
||||
|
||||
def stars(nick = "somebody", stars = 0):
|
||||
return "{} starred {}x".format(nick, stars)
|
||||
|
||||
def orders(product, limit = 5):
|
||||
return ["Product {}".format(i) for i in range(50)][:limit]
|
||||
|
||||
def arglen(*args, **kwargs):
|
||||
return [len(args), len(kwargs)]
|
||||
|
||||
self.register(ping, 'com.arguments.ping')
|
||||
self.register(add2, 'com.arguments.add2')
|
||||
self.register(stars, 'com.arguments.stars')
|
||||
self.register(orders, 'com.arguments.orders')
|
||||
self.register(arglen, 'com.arguments.arglen')
|
||||
|
||||
|
||||
|
||||
class ArgumentsFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component calling the different backend procedures.
|
||||
"""
|
||||
48
examples/twisted/wamp/basic/rpc/complex/backend.py
Normal file
48
examples/twisted/wamp/basic/rpc/complex/backend.py
Normal file
@@ -0,0 +1,48 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.wamp.types import CallResult
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
Application component that provides procedures which
|
||||
return complex results.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def add_complex(a, ai, b, bi):
|
||||
return CallResult(c = a + b, ci = ai + bi)
|
||||
|
||||
self.register(add_complex, 'com.myapp.add_complex')
|
||||
|
||||
def split_name(fullname):
|
||||
forename, surname = fullname.split()
|
||||
return CallResult(forename, surname)
|
||||
|
||||
self.register(split_name, 'com.myapp.split_name')
|
||||
@@ -24,32 +24,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class ComplexBackend(ApplicationSession):
|
||||
"""
|
||||
Application component that provides procedures which
|
||||
return complex results.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def add_complex(a, ai, b, bi):
|
||||
return CallResult(c = a + b, ci = ai + bi)
|
||||
|
||||
self.register(add_complex, 'com.myapp.add_complex')
|
||||
|
||||
def split_name(fullname):
|
||||
forename, surname = fullname.split()
|
||||
return CallResult(forename, surname)
|
||||
|
||||
self.register(split_name, 'com.myapp.split_name')
|
||||
|
||||
|
||||
|
||||
class ComplexFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
Application component that calls procedures which
|
||||
produce complex results and showing how to access those.
|
||||
@@ -36,7 +36,7 @@ class AppError1(Exception):
|
||||
|
||||
|
||||
|
||||
class ErrorsTestBackend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
Example WAMP application backend that raised exceptions.
|
||||
"""
|
||||
@@ -85,59 +85,3 @@ class ErrorsTestBackend(ApplicationSession):
|
||||
raise AppError1(b - a)
|
||||
|
||||
self.register(compare, 'com.myapp.compare')
|
||||
|
||||
|
||||
|
||||
class ErrorsTestFrontend(ApplicationSession):
|
||||
"""
|
||||
Example WAMP application frontend that catches exceptions.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
## catching standard exceptions
|
||||
##
|
||||
for x in [2, 0, -2]:
|
||||
try:
|
||||
res = yield self.call('com.myapp.sqrt', x)
|
||||
except Exception as e:
|
||||
print("Error: {} {}".format(e, e.args))
|
||||
else:
|
||||
print("Result: {}".format(res))
|
||||
|
||||
|
||||
## catching WAMP application exceptions
|
||||
##
|
||||
for name in ['foo', 'a', '*'*11, 'Hello']:
|
||||
try:
|
||||
res = yield self.call('com.myapp.checkname', name)
|
||||
except ApplicationError as e:
|
||||
print("Error: {} {} {} {}".format(e, e.error, e.args, e.kwargs))
|
||||
else:
|
||||
print("Result: {}".format(res))
|
||||
|
||||
|
||||
## defining and automapping WAMP application exceptions
|
||||
##
|
||||
self.define(AppError1)
|
||||
|
||||
try:
|
||||
yield self.call('com.myapp.compare', 3, 17)
|
||||
except AppError1 as e:
|
||||
print("Compare Error: {}".format(e))
|
||||
|
||||
|
||||
self.leave()
|
||||
|
||||
|
||||
def onLeave(self, details):
|
||||
self.disconnect()
|
||||
|
||||
|
||||
def onDisconnect(self):
|
||||
reactor.stop()
|
||||
91
examples/twisted/wamp/basic/rpc/errors/frontend.py
Normal file
91
examples/twisted/wamp/basic/rpc/errors/frontend.py
Normal file
@@ -0,0 +1,91 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
import math
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn import wamp
|
||||
from autobahn.wamp.exception import ApplicationError
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
@wamp.error("com.myapp.error1")
|
||||
class AppError1(Exception):
|
||||
"""
|
||||
An application specific exception that is decorated with a WAMP URI,
|
||||
and hence can be automapped by Autobahn.
|
||||
"""
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
Example WAMP application frontend that catches exceptions.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
## catching standard exceptions
|
||||
##
|
||||
for x in [2, 0, -2]:
|
||||
try:
|
||||
res = yield self.call('com.myapp.sqrt', x)
|
||||
except Exception as e:
|
||||
print("Error: {} {}".format(e, e.args))
|
||||
else:
|
||||
print("Result: {}".format(res))
|
||||
|
||||
|
||||
## catching WAMP application exceptions
|
||||
##
|
||||
for name in ['foo', 'a', '*'*11, 'Hello']:
|
||||
try:
|
||||
res = yield self.call('com.myapp.checkname', name)
|
||||
except ApplicationError as e:
|
||||
print("Error: {} {} {} {}".format(e, e.error, e.args, e.kwargs))
|
||||
else:
|
||||
print("Result: {}".format(res))
|
||||
|
||||
|
||||
## defining and automapping WAMP application exceptions
|
||||
##
|
||||
self.define(AppError1)
|
||||
|
||||
try:
|
||||
yield self.call('com.myapp.compare', 3, 17)
|
||||
except AppError1 as e:
|
||||
print("Compare Error: {}".format(e))
|
||||
|
||||
|
||||
self.leave()
|
||||
|
||||
|
||||
def onLeave(self, details):
|
||||
self.disconnect()
|
||||
|
||||
|
||||
def onDisconnect(self):
|
||||
reactor.stop()
|
||||
17
examples/twisted/wamp/basic/rpc/options/__init__.py
Normal file
17
examples/twisted/wamp/basic/rpc/options/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
@@ -24,7 +24,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class RpcOptionsBackend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component providing procedures with
|
||||
different kinds of arguments.
|
||||
@@ -50,36 +50,3 @@ class RpcOptionsBackend(ApplicationSession):
|
||||
return val * val
|
||||
|
||||
self.register(square, 'com.myapp.square', RegisterOptions(details_arg = 'details'))
|
||||
|
||||
|
||||
|
||||
class RpcOptionsFrontend(ApplicationSession):
|
||||
"""
|
||||
An application component calling the different backend procedures.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
def on_event(val):
|
||||
print("Someone requested to square non-positive: {}".format(val))
|
||||
|
||||
yield self.subscribe(on_event, 'com.myapp.square_on_nonpositive')
|
||||
|
||||
for val in [2, 0, -2]:
|
||||
res = yield self.call('com.myapp.square', val, options = CallOptions(discloseMe = True))
|
||||
print("Squared {} = {}".format(val, res))
|
||||
|
||||
self.leave()
|
||||
|
||||
|
||||
def onLeave(self, details):
|
||||
self.disconnect()
|
||||
|
||||
|
||||
def onDisconnect(self):
|
||||
reactor.stop()
|
||||
56
examples/twisted/wamp/basic/rpc/options/frontend.py
Normal file
56
examples/twisted/wamp/basic/rpc/options/frontend.py
Normal file
@@ -0,0 +1,56 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.wamp.types import CallOptions, RegisterOptions, PublishOptions
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component calling the different backend procedures.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
@inlineCallbacks
|
||||
def onJoin(self, details):
|
||||
|
||||
def on_event(val):
|
||||
print("Someone requested to square non-positive: {}".format(val))
|
||||
|
||||
yield self.subscribe(on_event, 'com.myapp.square_on_nonpositive')
|
||||
|
||||
for val in [2, 0, -2]:
|
||||
res = yield self.call('com.myapp.square', val, options = CallOptions(discloseMe = True))
|
||||
print("Squared {} = {}".format(val, res))
|
||||
|
||||
self.leave()
|
||||
|
||||
|
||||
def onLeave(self, details):
|
||||
self.disconnect()
|
||||
|
||||
|
||||
def onDisconnect(self):
|
||||
reactor.stop()
|
||||
49
examples/twisted/wamp/basic/rpc/progress/backend.py
Normal file
49
examples/twisted/wamp/basic/rpc/progress/backend.py
Normal file
@@ -0,0 +1,49 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks, returnValue
|
||||
|
||||
from autobahn.wamp.types import CallOptions, RegisterOptions
|
||||
from autobahn.twisted.util import sleep
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
Application component that produces progressive results.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
@inlineCallbacks
|
||||
def longop(n, details = None):
|
||||
if details.progress:
|
||||
for i in range(n):
|
||||
details.progress(i)
|
||||
yield sleep(1)
|
||||
else:
|
||||
yield sleep(1 * n)
|
||||
returnValue(n)
|
||||
|
||||
self.register(longop, 'com.myapp.longop', RegisterOptions(details_arg = 'details'))
|
||||
@@ -25,32 +25,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class ProgressiveBackend(ApplicationSession):
|
||||
"""
|
||||
Application component that produces progressive results.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
@inlineCallbacks
|
||||
def longop(n, details = None):
|
||||
if details.progress:
|
||||
for i in range(n):
|
||||
details.progress(i)
|
||||
yield sleep(1)
|
||||
else:
|
||||
yield sleep(1 * n)
|
||||
returnValue(n)
|
||||
|
||||
self.register(longop, 'com.myapp.longop', RegisterOptions(details_arg = 'details'))
|
||||
|
||||
|
||||
|
||||
class ProgressiveFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
Application component that consumes progressive results.
|
||||
"""
|
||||
40
examples/twisted/wamp/basic/rpc/timeservice/backend.py
Normal file
40
examples/twisted/wamp/basic/rpc/timeservice/backend.py
Normal file
@@ -0,0 +1,40 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
A simple time service application component.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def utcnow():
|
||||
now = datetime.datetime.utcnow()
|
||||
return now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
self.register(utcnow, 'com.timeservice.now')
|
||||
@@ -25,26 +25,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class TimeServiceBackend(ApplicationSession):
|
||||
"""
|
||||
A simple time service application component.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def utcnow():
|
||||
now = datetime.datetime.utcnow()
|
||||
return now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
self.register(utcnow, 'com.timeservice.now')
|
||||
|
||||
|
||||
|
||||
class TimeServiceFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component using the time service.
|
||||
"""
|
||||
17
examples/twisted/wamp/basic/session/series/__init__.py
Normal file
17
examples/twisted/wamp/basic/session/series/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
43
examples/twisted/wamp/basic/session/series/backend.py
Normal file
43
examples/twisted/wamp/basic/session/series/backend.py
Normal file
@@ -0,0 +1,43 @@
|
||||
###############################################################################
|
||||
##
|
||||
## Copyright (C) 2014 Tavendo GmbH
|
||||
##
|
||||
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||
## you may not use this file except in compliance with the License.
|
||||
## You may obtain a copy of the License at
|
||||
##
|
||||
## http://www.apache.org/licenses/LICENSE-2.0
|
||||
##
|
||||
## Unless required by applicable law or agreed to in writing, software
|
||||
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
## See the License for the specific language governing permissions and
|
||||
## limitations under the License.
|
||||
##
|
||||
###############################################################################
|
||||
|
||||
import datetime
|
||||
|
||||
from twisted.internet import reactor
|
||||
from twisted.internet.defer import inlineCallbacks
|
||||
|
||||
from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
A simple time service application component.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def utcnow():
|
||||
now = datetime.datetime.utcnow()
|
||||
return now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
self.register(utcnow, 'com.timeservice.now')
|
||||
@@ -25,26 +25,7 @@ from autobahn.twisted.wamp import ApplicationSession
|
||||
|
||||
|
||||
|
||||
class SeriesTestBackend(ApplicationSession):
|
||||
"""
|
||||
A simple time service application component.
|
||||
"""
|
||||
|
||||
def onConnect(self):
|
||||
self.join("realm1")
|
||||
|
||||
|
||||
def onJoin(self, details):
|
||||
|
||||
def utcnow():
|
||||
now = datetime.datetime.utcnow()
|
||||
return now.strftime("%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
self.register(utcnow, 'com.timeservice.now')
|
||||
|
||||
|
||||
|
||||
class SeriesTestFrontend(ApplicationSession):
|
||||
class Component(ApplicationSession):
|
||||
"""
|
||||
An application component using the time service
|
||||
during 3 subsequent WAMP sessions, while the
|
||||
Reference in New Issue
Block a user