autobahn - Handshake problems -


i having bit of problem when using crossbar. start running autobahn python backend , autobahn js frontend , seems normal until error:

2016-08-01t14:12:40+0000 [router       9051] failing websocket opening handshake ('websocket connection denied: origin 'null' not allowed') 

any idea why? , how solve it?

edit:

here code (i'm using wamp) believe problem isn't code related because has worked in other networks, not in 1 im in right now. anyways:

frontend:

<!doctype html> <html>    <body>       <h1>hello wamp/browser - frontend</h1>       <p>open javascript console watch output.</p>       <script>autobahn_debug = true;</script>       <script src="http://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz"></script>        <script>          // url of wamp router (crossbar.io)          //          var wsuri = "ws://192.168.4.24:8080/";            // wamp connection router          //          var connection = new autobahn.connection({             url: wsuri,             realm: "joypadrealm"          });            // timers          //          var t1, t2;            // fired when connection established , session attached          //          connection.onopen = function (session, details) {              console.log("connected");              // subscribe topic , receive events             //             function on_counter (args) {                var counter = args[0];                console.log("on_counter() event received counter " + counter);             }             session.subscribe('com.example.oncounter', on_counter).then(                function (sub) {                   console.log('subscribed topic');                },                function (err) {                   console.log('failed subscribe topic', err);                }             );               // publish event every second             //             t1 = setinterval(function () {                 session.publish('com.example.onhello', ['hello javascript (browser)']);                console.log("published topic 'com.example.onhello'");             }, 1000);               // register procedure remote calling             //             function mul2 (args) {                var x = args[0];                var y = args[1];                console.log("mul2() called " + x + " , " + y);                return x * y;             }             session.register('com.example.mul2', mul2).then(                function (reg) {                   console.log('procedure registered');                },                function (err) {                   console.log('failed register procedure', err);                }             );               // call remote procedure every second             //             var x = 0;              t2 = setinterval(function () {                 session.call('com.example.add2', [x, 18]).then(                   function (res) {                      console.log("add2() result:", res);                   },                   function (err) {                      console.log("add2() error:", err);                   }                );                 x += 3;             }, 1000);          };            // fired when connection lost (or not established)          //          connection.onclose = function (reason, details) {             console.log("connection lost: " + reason);             if (t1) {                clearinterval(t1);                t1 = null;             }             if (t2) {                clearinterval(t2);                t2 = null;             }          }            // open connection          //          connection.open();        </script>    </body> </html> 

backend:

from twisted.internet.defer import inlinecallbacks twisted.logger import logger os import environ autobahn.twisted.util import sleep autobahn.twisted.wamp import applicationsession, applicationrunner autobahn.wamp.exception import applicationerror    class appsession(applicationsession):      log = logger()      @inlinecallbacks     def onjoin(self, details):          ## subscribe topic , receive events         ##         def onhello(msg):             self.log.info("event 'onhello' received: {msg}", msg=msg)          sub = yield self.subscribe(onhello, 'com.example.onhello')         self.log.info("subscribed topic 'onhello'")           ## register procedure remote calling         ##         def add2(x, y):             self.log.info("add2() called {x} , {y}", x=x, y=y)             return x + y          reg = yield self.register(add2, 'com.example.add2')         self.log.info("procedure add2() registered")           ## publish , call every second .. forever         ##         counter = 0         while true:              ## publish event             ##             yield self.publish('com.example.oncounter', counter)             self.log.info("published 'oncounter' counter {counter}",                           counter=counter)             counter += 1               ## call remote procedure             ##             try:                 res = yield self.call('com.example.mul2', counter, 3)                 self.log.info("mul2() called result: {result}",                               result=res)             except applicationerror e:                 ## ignore errors due frontend not yet having                 ## registered procedure call                 if e.error != 'wamp.error.no_such_procedure':                     raise e               yield sleep(1)   if __name__ == '__main__':     runner = applicationrunner(         environ.get("autobahn_demo_router", u"ws://192.168.4.24:8080/"),         u"joypadrealm",     )     runner.run(appsession) 

config.json

{     "version": 2,     "controller": {},     "workers": [         {             "type": "router",             "realms": [                 {                     "name": "joypadrealm",                     "roles": [                         {                             "name": "anonymous",                             "permissions": [                                 {                                     "uri": "",                                     "match": "prefix",                                     "allow": {                                         "call": true,                                         "register": true,                                         "publish": true,                                         "subscribe": true                                     },                                     "disclose": {                                         "caller": false,                                         "publisher": false                                     },                                     "cache": true                                 }                             ]                         }                     ]                 }             ],             "transports": [         {             "type": "websocket",             "endpoint": {                 "type": "tcp",                 "port": 8080             },             "url": "ws://localhost:8080/"            }             ]         }     ] } 


Comments