Icham,
arguable, the simplest way of sending WAMP events from the CLI isn't
using Autobahn or anything at all, but simply "curl" (or any other
thingy that can issue a HTTP/POST) plus the HTTP-pusher service of
Crossbar.io:
curl -H "Content-Type: application/json" \
-d '{"topic": "com.myapp.topic1", "args": ["Hello, world"]}' \
http://127.0.0.1:8080/push
http://crossbar.io/docs/HTTP-Pusher-Service/
===
If you want to follow the route you've been starting with your code
below, pass the message via the "extra" attribute to ApplicationRunner.
You can access this within your ApplicationSession class as
self.config.extra.
Cheers,
/Tobias
Am 07.11.2014 16:18, schrieb Icham Achtir:
>
> hi,
>
> i need to send message from a command line to the web user using wamp.
> i can send a static message but i need to change the message based to
> the notify.py script argument
> also i don't know if my code is the correct way and the easiest way to
> do this???
> Could you help?
>
> here is my code
>
> |
> fromtwisted.internet importreactor
> fromtwisted.internet.defer importinlineCallbacks
> fromautobahn.twisted.wamp importApplicationSession
> classComponent(ApplicationSession):
> @inlineCallbacks
> defonJoin(self,details):
> defonevent(msg):
> print("Got event: {}".format(msg))
>
> yieldself.subscribe(onevent,'com.myapp.notify')
> self.publish('com.Myapp.notify',"message")
> self.leave()
> defonDisconnect(self):
> print("disconnected")
> reactor.stop()
> if__name__ =='__main__':
> fromautobahn.twisted.wamp importApplicationRunner
> runner
> =ApplicationRunner("ws://
127.0.0.1:8888/ws","realm1",standalone=False,debug=False,debug_wamp=False,debug_app=False)
> runner.run(Component)
> |
>
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
autobahnws+...@googlegroups.com
> <mailto:
autobahnws+...@googlegroups.com>.
> To post to this group, send email to
autob...@googlegroups.com
> <mailto:
autob...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/autobahnws/e77f2151-874c-419b-8b53-9aec82548cae%40googlegroups.com
> <
https://groups.google.com/d/msgid/autobahnws/e77f2151-874c-419b-8b53-9aec82548cae%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.