more README
This commit is contained in:
45
examples/pubsub/authorization/README.md
Normal file
45
examples/pubsub/authorization/README.md
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
Writing custom PubSub handlers for Authorization
|
||||||
|
================================================
|
||||||
|
|
||||||
|
This example show how to write custom PubSub handlers and use that for
|
||||||
|
implementing fine-grained authorization.
|
||||||
|
|
||||||
|
It includes a server which register a custom PubSub handler for topics,
|
||||||
|
a JavaScript client using AutobahnJS and a Python client using AutobahnPython
|
||||||
|
both doing publish and subscribe.
|
||||||
|
|
||||||
|
Further, since it's a standard WAMP service, any WAMP client can use
|
||||||
|
the service. You could access it i.e. from a native Android app via AutobahnAndroid.
|
||||||
|
|
||||||
|
Running
|
||||||
|
-------
|
||||||
|
|
||||||
|
Run the server by doing
|
||||||
|
|
||||||
|
python server.py
|
||||||
|
|
||||||
|
and open
|
||||||
|
|
||||||
|
http://localhost:8080/
|
||||||
|
|
||||||
|
in **2 tabs/windows** of your browser.
|
||||||
|
|
||||||
|
|
||||||
|
To activate debug output on the server, start it
|
||||||
|
|
||||||
|
python server.py debug
|
||||||
|
|
||||||
|
This will show up all WAMP messages exchanged between clients and server.
|
||||||
|
|
||||||
|
To use the Python client, do
|
||||||
|
|
||||||
|
python client.py
|
||||||
|
|
||||||
|
|
||||||
|
Perspective
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Fine-grained authorization for topics is just one application of custom PubSub handlers.
|
||||||
|
|
||||||
|
Custom PubSub handlers allow you to hook into the AutobahnPython PubSub machinery
|
||||||
|
and do very flexible things.
|
||||||
@@ -1,10 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Autobahn: PubSub with Authorization</title>
|
|
||||||
|
|
||||||
<!-- include AutobahnJS .. that's all you need -->
|
<!-- include AutobahnJS .. that's all you need -->
|
||||||
<script src="http://autobahn.ws/public/autobahn.min.js"></script>
|
<script src="http://autobahn.s3.amazonaws.com/js/autobahn.min.js"></script>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
// WAMP session object
|
// WAMP session object
|
||||||
@@ -65,7 +63,7 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Autobahn: PubSub with Authorization</h1>
|
<h1>AutobahnJS PubSub Client - PubSub with Authorization</h1>
|
||||||
<button onclick="test()">Publish Events</button>
|
<button onclick="test()">Publish Events</button>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user