Metaevent.session.on_join not firing with auth on a websocket transport

#1

Hello,

I am unsure whether this is a bug or by design. My application is not getting session.on_join or session.on_leave metaevents on websocket transports with authentication enabled.
Is this supposed to happen? Do these meta.events only fire on ‘web’ transports?

Rgds,
Reda

0 Likes

#2

Here is my config.json:

{
“controller”: {
},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “authenticator”,
“permissions”: [
{
“uri”: “ws.mass.authenticate”,
“register”: true
}
]
},
{
“name”: “backend”,
“permissions”: [
{
“uri”: “",
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
},
{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: "ws.mass.public.
”,
“subscribe”: true,
“call”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “websocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 9000
},
“auth”: {
“wampcra”: {
“type”: “static”,
“users”: {
“authenticator1”: {
“secret”: “secret123”,
“role”: “authenticator”
}
}
}
},
“options”: {
“enable_webstatus”: false,
“enable_hixie76”: false,
“max_frame_size”: 1048576,
“max_message_size”: 1048576,
“auto_fragment_size”: 65536,
“fail_by_drop”: true,
“open_handshake_timeout”: 2500,
“close_handshake_timeout”: 1000,
“auto_ping_interval”: 10000,
“auto_ping_timeout”: 5000,
“auto_ping_size”: 4,
“allowed_origins”: [
“http://*.mass.ws”,
“*localhost:9000”,
127.0.0.1:9000"
]
}
},
{
“type”: “websocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8080
},
“auth”:{
“wampcra”: {
“type”: “dynamic”,
“authenticator”: “ws.mass.authenticate”
}
},
“options”: {
“enable_webstatus”: false,
“enable_hixie76”: false,
“max_frame_size”: 1048576,
“max_message_size”: 1048576,
“auto_fragment_size”: 65536,
“fail_by_drop”: true,
“open_handshake_timeout”: 2500,
“close_handshake_timeout”: 1000,
“auto_ping_interval”: 10000,
“auto_ping_timeout”: 5000,
“auto_ping_size”: 4,
“allowed_origins”: [
"http://
.mass.ws”,
localhost”,
127.0.0.1
]
}
}
]
},
{
“type”: “guest”,
“executable”: “/usr/bin/nodejs”,
“arguments”: [
“authenticator.js”,
“ws://127.0.0.1:9000”,
“realm1”,
“authenticator1”,
“secret123”
],
“options”: {
“workdir”: “…”
}
},
{
“type”: “guest”,
“executable”: “/usr/bin/nodejs”,
“arguments”: [
“main.js”
],
“options”: {
“workdir”: “…”
}
}
]
}

···

On Tuesday, 18 November 2014 23:51:28 UTC, reda...@gmail.com wrote:

Hello,

I am unsure whether this is a bug or by design. My application is not getting session.on_join or session.on_leave metaevents on websocket transports with authentication enabled.
Is this supposed to happen? Do these meta.events only fire on ‘web’ transports?

Rgds,
Reda

0 Likes

#3

Assuming that this is a real bug (which I think it is after plenty of testing), could you let me know whether the on_join event is supposed to be raised before or after the challenge/response has occurred?
Knowing this in advance would help me circumnavigate the existing issue and continue working on the login and login queuing system that I am working on.

Rgds,
Reda

···

On Wednesday, 19 November 2014 01:21:19 UTC, reda...@gmail.com wrote:

Hello,

I am unsure whether this is a bug or by design. My application is not getting session.on_join or session.on_leave metaevents on websocket transports with authentication enabled.
Is this supposed to happen? Do these meta.events only fire on ‘web’ transports?

Rgds,
Reda

Here is my config.json:

{
“controller”: {
},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “authenticator”,
“permissions”: [
{
“uri”: “ws.mass.authenticate”,
“register”: true
}
]
},
{
“name”: “backend”,
“permissions”: [
{
“uri”: “",
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
},
{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: "ws.mass.public.
”,
“subscribe”: true,
“call”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “websocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 9000
},
“auth”: {
“wampcra”: {
“type”: “static”,
“users”: {
“authenticator1”: {
“secret”: “secret123”,
“role”: “authenticator”
}
}
}
},
“options”: {
“enable_webstatus”: false,
“enable_hixie76”: false,
“max_frame_size”: 1048576,
“max_message_size”: 1048576,
“auto_fragment_size”: 65536,
“fail_by_drop”: true,
“open_handshake_timeout”: 2500,
“close_handshake_timeout”: 1000,
“auto_ping_interval”: 10000,
“auto_ping_timeout”: 5000,
“auto_ping_size”: 4,
“allowed_origins”: [
“http://.mass.ws",
localhost:9000",
"
127.0.0.1:9000
]
}
},
{
“type”: “websocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 8080
},
“auth”:{
“wampcra”: {
“type”: “dynamic”,
“authenticator”: “ws.mass.authenticate”
}
},
“options”: {
“enable_webstatus”: false,
“enable_hixie76”: false,
“max_frame_size”: 1048576,
“max_message_size”: 1048576,
“auto_fragment_size”: 65536,
“fail_by_drop”: true,
“open_handshake_timeout”: 2500,
“close_handshake_timeout”: 1000,
“auto_ping_interval”: 10000,
“auto_ping_timeout”: 5000,
“auto_ping_size”: 4,
“allowed_origins”: [
"http://
.mass.ws”,
localhost”,
127.0.0.1
]
}
}
]
},
{
“type”: “guest”,
“executable”: “/usr/bin/nodejs”,
“arguments”: [
“authenticator.js”,
“ws://127.0.0.1:9000”,
“realm1”,
“authenticator1”,
“secret123”
],
“options”: {
“workdir”: “…”
}
},
{
“type”: “guest”,
“executable”: “/usr/bin/nodejs”,
“arguments”: [
“main.js”
],
“options”: {
“workdir”: “…”
}
}
]
}

On Tuesday, 18 November 2014 23:51:28 UTC, reda...@gmail.com wrote:

0 Likes

#4

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

0 Likes

#5

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

···

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

0 Likes

#6

FYI, the moment I turn off authentication in the config, the tests fail but I get my events raised. Ignore the missing semi colons from the copy pasted section. I have added them and no errors are being thrown.

Furthermore, when running crossbar in debug mode, I can see that some fundamental websocket/hello stuff seems to be missing from the output when auth is turned on. But that can’t be true since it’s obviously connecting. It’s just that the events don’t get dispatched.

···

On Friday, 21 November 2014 22:18:01 UTC, reda...@gmail.com wrote:

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

0 Likes

#7

HOLY MOTHER OF GOD!!!

I an act of desperation I added the following extra permission section to the config and that made it work!!!:

{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: “wamp.*”,
“publish”: true
}
]
}

I don’t know why, but I would have never expected that it was the client actually publishing this event to the server. I thought it would be something that happened internally. You might want to add this to the documentation.

@Greg, thank you for letting me doubt my config once more and try a couple of things out of desperation. It helped.

Kind Regards,
Reda Borchardt

···

On Friday, 21 November 2014 22:23:01 UTC, reda...@gmail.com wrote:

FYI, the moment I turn off authentication in the config, the tests fail but I get my events raised. Ignore the missing semi colons from the copy pasted section. I have added them and no errors are being thrown.

Furthermore, when running crossbar in debug mode, I can see that some fundamental websocket/hello stuff seems to be missing from the output when auth is turned on. But that can’t be true since it’s obviously connecting. It’s just that the events don’t get dispatched.

On Friday, 21 November 2014 22:18:01 UTC, reda...@gmail.com wrote:

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

0 Likes

#8

So just to be clear. In a real world scenario, you would need to do this for all of your roles:

              {
                 "name": "anonymousfrontend",
                 "permissions": [
                    {
                       "uri": "ws.mass.public.*",                          
                       "subscribe": true,                          
                       "call": true                          
                    },
                    {
                       "uri": "wamp.*",                          
                       "publish": true        
                    }
                 ]
              }

``

···

On Friday, 21 November 2014 22:47:43 UTC, reda...@gmail.com wrote:

FYI, the moment I turn off authentication in the config, the tests fail but I get my events raised. Ignore the missing semi colons from the copy pasted section. I have added them and no errors are being thrown.

Furthermore, when running crossbar in debug mode, I can see that some fundamental websocket/hello stuff seems to be missing from the output when auth is turned on. But that can’t be true since it’s obviously connecting. It’s just that the events don’t get dispatched.

On Friday, 21 November 2014 22:18:01 UTC, reda...@gmail.com wrote:

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

HOLY MOTHER OF GOD!!!

I an act of desperation I added the following extra permission section to the config and that made it work!!!:

{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: “wamp.*”,
“publish”: true
}
]
}

I don’t know why, but I would have never expected that it was the client actually publishing this event to the server. I thought it would be something that happened internally. You might want to add this to the documentation.

@Greg, thank you for letting me doubt my config once more and try a couple of things out of desperation. It helped.

Kind Regards,
Reda Borchardt
On Friday, 21 November 2014 22:23:01 UTC, reda...@gmail.com wrote:

0 Likes

#9

Yeah, you found it. I guess this means I don’t get a burger/beer. :slight_smile:

I did find something else that was odd. Once I enabled the auth for the frontend I had to enable auth for the backend. Otherwise the backend wouldn’t connect. From Tobias’ example I combined the auth and backend together, added in the auth.wampcra stuff, and tried it and nothing worked. So I cut/paste more of his code to have the backend authed, then it all started working. So now I have backend and frontend roles, both being authed. This is my config, which seems to be a lot simpler than yours, but maybe you need all those other values.

{
“controller”: {
},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “backend”,
“permissions”: [
{
“uri”: “",
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
},
{
“name”: “frontend”,
“permissions”: [
{
“uri”: "
”,
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “websocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 9000,
“interface”: “127.0.0.1”
},
“auth”: {
“wampcra”: {
“type”: “static”,
“users”: {
“contacts”: {
“secret”: “secret123”,
“role”: “backend”
}
}
}
}
},

        {
           "type": "web",
           "endpoint": {
              "type": "tcp",
              "port": 8000
           },
           "paths": {
              "/": {
                 "type": "static",
                 "directory": "../web"
              },
              "ws": {
                 "type": "websocket",
                 "auth": {
                    "wampcra": {
                       "type": "dynamic",
                       "authenticator": "auth.cra.login"
                    }
                 }                    
              }
           }
        }
     ]
  },
  {
     "type": "guest",
     "executable": "/usr/bin/node",
     "arguments": [
        "hello.js",
        "ws://127.0.0.1:9000",
        "realm1",
        "contacts",
        "secret123"          
     ],
     "options": {
        "workdir": "../node",
        "watch": {
           "directories": ["../node"],
           "action": "restart"
        }
     }
  }

]
}

``

0 Likes

#10

You still deserve your beer and burger. :smiley:

···

On Friday, 21 November 2014 23:58:12 UTC, Greg Miller wrote:

Yeah, you found it. I guess this means I don’t get a burger/beer. :slight_smile:

I did find something else that was odd. Once I enabled the auth for the frontend I had to enable auth for the backend. Otherwise the backend wouldn’t connect. From Tobias’ example I combined the auth and backend together, added in the auth.wampcra stuff, and tried it and nothing worked. So I cut/paste more of his code to have the backend authed, then it all started working. So now I have backend and frontend roles, both being authed. This is my config, which seems to be a lot simpler than yours, but maybe you need all those other values.

{
“controller”: {
},
“workers”: [
{
“type”: “router”,
“realms”: [
{
“name”: “realm1”,
“roles”: [
{
“name”: “backend”,
“permissions”: [
{
“uri”: “",
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
},
{
“name”: “frontend”,
“permissions”: [
{
“uri”: "
”,
“publish”: true,
“subscribe”: true,
“call”: true,
“register”: true
}
]
}
]
}
],
“transports”: [
{
“type”: “websocket”,
“endpoint”: {
“type”: “tcp”,
“port”: 9000,
“interface”: “127.0.0.1”
},
“auth”: {
“wampcra”: {
“type”: “static”,
“users”: {
“contacts”: {
“secret”: “secret123”,
“role”: “backend”
}
}
}
}
},

        {
           "type": "web",
           "endpoint": {
              "type": "tcp",
              "port": 8000
           },
           "paths": {
              "/": {
                 "type": "static",
                 "directory": "../web"
              },
              "ws": {
                 "type": "websocket",
                 "auth": {
                    "wampcra": {
                       "type": "dynamic",
                       "authenticator": "auth.cra.login"
                    }
                 }                    
              }
           }
        }
     ]
  },
  {
     "type": "guest",
     "executable": "/usr/bin/node",
     "arguments": [
        "hello.js",
        "ws://[127.0.0.1:9000](http://127.0.0.1:9000)",
        "realm1",
        "contacts",
        "secret123"          
     ],
     "options": {
        "workdir": "../node",
        "watch": {
           "directories": ["../node"],
           "action": "restart"
        }
     }
  }

]
}

``

0 Likes

#11

Hi Reda,

sorry to only get back to this issue now.

A WAMP component that wants to receive meta events should have permission to subscribe to wamp.*.

This should be both necessary and sufficient.

A permission to publish to such URIs should not be necessary - if this is the case, we have a bug.

Metaevents are generated by the router (well, a trusted service component running inside the router to be precise) - not the component that is joining/leaving. I am reopening the issue and will check this in detail now …

Cheers,
/Tobias

···

Am Freitag, 21. November 2014 23:47:43 UTC+1 schrieb reda...@gmail.com:

FYI, the moment I turn off authentication in the config, the tests fail but I get my events raised. Ignore the missing semi colons from the copy pasted section. I have added them and no errors are being thrown.

Furthermore, when running crossbar in debug mode, I can see that some fundamental websocket/hello stuff seems to be missing from the output when auth is turned on. But that can’t be true since it’s obviously connecting. It’s just that the events don’t get dispatched.

On Friday, 21 November 2014 22:18:01 UTC, reda...@gmail.com wrote:

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

HOLY MOTHER OF GOD!!!

I an act of desperation I added the following extra permission section to the config and that made it work!!!:

{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: “wamp.*”,
“publish”: true
}
]
}

I don’t know why, but I would have never expected that it was the client actually publishing this event to the server. I thought it would be something that happened internally. You might want to add this to the documentation.

@Greg, thank you for letting me doubt my config once more and try a couple of things out of desperation. It helped.

Kind Regards,
Reda Borchardt
On Friday, 21 November 2014 22:23:01 UTC, reda...@gmail.com wrote:

0 Likes

#12

Hi Reda,

Alright. There was indeed a bug (fixed now): https://github.com/crossbario/crossbar/issues/177

I tested the reception of meta events in both container hosted and router internal Python WAMP components.

Yes, the docs definitely should mention that the monitoring component needs “subscribe” permission on “wamp.metaevent.session.on_join”. I’ve added some notes and example configuration here:

https://github.com/crossbario/crossbar/wiki/Session-Metaevents

Thanks for your patience with this stuff;)

/Tobias

···

Am Samstag, 22. November 2014 09:02:28 UTC+1 schrieb Tobias Oberstein:

Hi Reda,

sorry to only get back to this issue now.

A WAMP component that wants to receive meta events should have permission to subscribe to wamp.*.

This should be both necessary and sufficient.

A permission to publish to such URIs should not be necessary - if this is the case, we have a bug.

Metaevents are generated by the router (well, a trusted service component running inside the router to be precise) - not the component that is joining/leaving. I am reopening the issue and will check this in detail now …

Cheers,
/Tobias

Am Freitag, 21. November 2014 23:47:43 UTC+1 schrieb reda...@gmail.com:

FYI, the moment I turn off authentication in the config, the tests fail but I get my events raised. Ignore the missing semi colons from the copy pasted section. I have added them and no errors are being thrown.

Furthermore, when running crossbar in debug mode, I can see that some fundamental websocket/hello stuff seems to be missing from the output when auth is turned on. But that can’t be true since it’s obviously connecting. It’s just that the events don’t get dispatched.

On Friday, 21 November 2014 22:18:01 UTC, reda...@gmail.com wrote:

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

HOLY MOTHER OF GOD!!!

I an act of desperation I added the following extra permission section to the config and that made it work!!!:

{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: “wamp.*”,
“publish”: true
}
]
}

I don’t know why, but I would have never expected that it was the client actually publishing this event to the server. I thought it would be something that happened internally. You might want to add this to the documentation.

@Greg, thank you for letting me doubt my config once more and try a couple of things out of desperation. It helped.

Kind Regards,
Reda Borchardt
On Friday, 21 November 2014 22:23:01 UTC, reda...@gmail.com wrote:

0 Likes

#13

You are a busy man! Thanks for the fix.

···

On Monday, 24 November 2014 08:41:40 UTC, Tobias Oberstein wrote:

Hi Reda,

sorry to only get back to this issue now.

A WAMP component that wants to receive meta events should have permission to subscribe to wamp.*.

This should be both necessary and sufficient.

A permission to publish to such URIs should not be necessary - if this is the case, we have a bug.

Metaevents are generated by the router (well, a trusted service component running inside the router to be precise) - not the component that is joining/leaving. I am reopening the issue and will check this in detail now …

Cheers,
/Tobias

Am Freitag, 21. November 2014 23:47:43 UTC+1 schrieb reda...@gmail.com:

FYI, the moment I turn off authentication in the config, the tests fail but I get my events raised. Ignore the missing semi colons from the copy pasted section. I have added them and no errors are being thrown.

Furthermore, when running crossbar in debug mode, I can see that some fundamental websocket/hello stuff seems to be missing from the output when auth is turned on. But that can’t be true since it’s obviously connecting. It’s just that the events don’t get dispatched.

On Friday, 21 November 2014 22:18:01 UTC, reda...@gmail.com wrote:

Hi Greg,

Thank you for your reply. I am baffled. Something about the way I do this is breaking the metaevent whenever auth is enabled. I have been fiddling around a lot over the past couple of days and cannot put my finger on the issue.

Here is my test page with the client side script: http://www.mass.ws/io/examples/apitest/
This is the client js file: http://www.mass.ws/io/examples/apitest/_resources/unittest.js

And here is my onopen section:

Massws.prototype.init = function(){
var _this = this;

this.connection.onopen = function(session){        
    _this.session = session;

    session.register('ws.mass.public.ping', function(args, kwargs, details){return _this.ping(args, kwargs, details);}).then(
        function(registration){
            console.log(('SUCCESS! Procedure registered '+ registration.procedure).bgGreen);
        },
        function(error){
            console.log(('Registration failed'+ error).bgRed);
        }
    );

    session.subscribe('wamp.metaevent.session.on_join', function(ev, details, lw) {
        console.log('onjoin', ev)
        console.log(details)
        console.log('lw ',lw)    
     })

};
this.connection.open();

};

``

Anybody that can tell me what the issue is will get a free beer and burger if you are around London/Soho.

On Friday, 21 November 2014 21:50:13 UTC, Greg Miller wrote:

I got cra auth going in node.js and the on_join is working fine. This is my exact code:

session.subscribe(‘wamp.metaevent.session.on_join’, function(ev, details, lw) {
console.log(‘onjoin’, ev)
console.log(details)
console.log('lw ',lw)
})

``

It fires after the challenge has occurred.

HOLY MOTHER OF GOD!!!

I an act of desperation I added the following extra permission section to the config and that made it work!!!:

{
“name”: “anonymousfrontend”,
“permissions”: [
{
“uri”: “wamp.*”,
“publish”: true
}
]
}

I don’t know why, but I would have never expected that it was the client actually publishing this event to the server. I thought it would be something that happened internally. You might want to add this to the documentation.

@Greg, thank you for letting me doubt my config once more and try a couple of things out of desperation. It helped.

Kind Regards,
Reda Borchardt
On Friday, 21 November 2014 22:23:01 UTC, reda...@gmail.com wrote:

Hi Reda,

Alright. There was indeed a bug (fixed now): https://github.com/crossbario/crossbar/issues/177

I tested the reception of meta events in both container hosted and router internal Python WAMP components.

Yes, the docs definitely should mention that the monitoring component needs “subscribe” permission on “wamp.metaevent.session.on_join”. I’ve added some notes and example configuration here:

https://github.com/crossbario/crossbar/wiki/Session-Metaevents

Thanks for your patience with this stuff;)

/Tobias

Am Samstag, 22. November 2014 09:02:28 UTC+1 schrieb Tobias Oberstein:

0 Likes