Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class NAV {
- constructor(name, url="ws://localhost:8080/ws", realm="realm1"){
- this.name = name;
- this.url = url;
- this.realm = realm;
- this.connection = new autobahn.Connection({
- url: this.url,
- realm: this.realm
- });
- this.connection.onopen = (session => this.on_open(session))
- this.connection.open()
- }
- on_open(session){
- this.session = session;
- this.session.subscribe('org.nav.modules.' + this.name, this.on_message);
- console.log('org.nav.modules.' + this.name)
- this.session.publish('org.nav.announce', [this.name]);
- }
- on_message(message){
- console.log("THIS ON MESSAGE")
- console.log(message);
- }
- send_command(target, subject, payload){
- }
- }
- var nav = new NAV('test_module');
Advertisement
Add Comment
Please, Sign In to add comment