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>
 | 
			
		||||
 <html>
 | 
			
		||||
   <head>
 | 
			
		||||
      <title>Autobahn: PubSub with Authorization</title>
 | 
			
		||||
 | 
			
		||||
      <!-- 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>
 | 
			
		||||
         // WAMP session object
 | 
			
		||||
@@ -56,7 +54,7 @@
 | 
			
		||||
            sess.publish("event:simple-foobar", {name: "foo",
 | 
			
		||||
                                                 value: "bar",
 | 
			
		||||
                                                 num: 333});
 | 
			
		||||
            
 | 
			
		||||
 | 
			
		||||
            sess.publish("event:foobar1", {count: 42});
 | 
			
		||||
            sess.publish("event:foobar1", {count: -1});
 | 
			
		||||
            sess.publish("event:foobar2", {count: 666});
 | 
			
		||||
@@ -65,7 +63,7 @@
 | 
			
		||||
     </script>
 | 
			
		||||
   </head>
 | 
			
		||||
   <body>
 | 
			
		||||
      <h1>Autobahn: PubSub with Authorization</h1>
 | 
			
		||||
      <h1>AutobahnJS PubSub Client - PubSub with Authorization</h1>
 | 
			
		||||
      <button onclick="test()">Publish Events</button>
 | 
			
		||||
   </body>
 | 
			
		||||
 </html>
 | 
			
		||||
		Reference in New Issue
	
	Block a user