The code runs unaltered in the browser or Node.js

So many documentation problems …

  1. trying to run autobahn JS in a browser

Reading up on docs here:

https://github.com/crossbario/autobahn-js

It says: “The code runs unaltered in the browser or Node.js” … except, no it doesn’t.

client.php:41

Uncaught ReferenceError: require is not defined

var autobahn = require(‘autobahn’);

require(…) isn’t working in the browser. Now what? Apparently this code DOESNT run unaltered in a browser.

  1. The Getting Started docs are busted

https://github.com/crossbario/autobahn-js/blob/master/doc/programming.md

"We need to include the Autobahn|JS library in our JavaScript. There are instructions in Getting Started for how

to do this in the browser and in Node.js. This also links to available WAMP routers. In this documentation

use of Crossbar.io is assumed, but examples should work with other routers as well."

Well, clicking on the “Getting Started” link goes to a broken page. I wanted those instructions on getting started in a browser. sigh

BROKEN: https://github.com/crossbario/autobahn-js/blob/master/getting-started.md

– Dante

So many documentation problems ...

1) trying to run autobahn JS in a browser

Reading up on docs here:

https://github.com/crossbario/autobahn-js

It says: "The code runs unaltered in the browser or Node.js" ... except, no
it doesn't.

client.php:41

Uncaught ReferenceError: require is not defined

well, you have to load the library differently in browser vs node.

var autobahn = require('autobahn');

require(...) isn't working in the browser. Now what? Apparently this code

<script src="autobahn.min.js"></script>

DOESNT run unaltered in a browser.

sure it does!

it is just the _loading_ that differs.

2) The Getting Started docs are busted

https://github.com/crossbario/autobahn-js/blob/master/doc/programming.md

"We need to include the Autobahn|JS library in our JavaScript. There are
instructions in *Getting Started* for how
to do this in the browser and in Node.js. This also links to available WAMP
routers. In this documentation
use of Crossbar.io is assumed, but examples should work with other routers
as well."

Well, clicking on the "Getting Started" link goes to a broken page. I
wanted those instructions on getting started in a browser. *sigh*

BROKEN:
https://github.com/crossbario/autobahn-js/blob/master/getting-started.md

fixed.

the correct link is:

https://github.com/crossbario/autobahn-js/blob/master/doc/getting-started.md

···

Am 29.06.2017 um 06:25 schrieb da...@lorenso.com:

-- Dante

Hi Dante!

Fixed the loading so that it does work completely unaltered in the browser (as it says). As Tobias says, though, you have to load the library separately in the browser.

Regards,

Alex

I’m happy to see you guys so responsive to my feedback. Let’s give that code one more review, however …

try {
// for Node.js
   var autobahn = require('autobahn');
} catch (e) {
// for browsers (where AutobahnJS is available globally)
}
var autobahn = require('autobahn');

I’m not running this in a browser or anything, but I can already tell you it doesn’t work.

Maybe try one more time :slight_smile:

– Dante

···

On Wednesday, June 28, 2017 at 11:25:43 PM UTC-5, da...@lorenso.com wrote:

So many documentation problems …

  1. trying to run autobahn JS in a browser

Reading up on docs here:

https://github.com/crossbario/autobahn-js

It says: “The code runs unaltered in the browser or Node.js” … except, no it doesn’t.

client.php:41

Uncaught ReferenceError: require is not defined

var autobahn = require(‘autobahn’);

require(…) isn’t working in the browser. Now what? Apparently this code DOESNT run unaltered in a browser.

  1. The Getting Started docs are busted

https://github.com/crossbario/autobahn-js/blob/master/doc/programming.md

"We need to include the Autobahn|JS library in our JavaScript. There are instructions in Getting Started for how

to do this in the browser and in Node.js. This also links to available WAMP routers. In this documentation

use of Crossbar.io is assumed, but examples should work with other routers as well."

Well, clicking on the “Getting Started” link goes to a broken page. I wanted those instructions on getting started in a browser. sigh

BROKEN: https://github.com/crossbario/autobahn-js/blob/master/getting-started.md

– Dante

… fixed.

A pull request for something like this would be greatly appreciated in principle!

···

Am Freitag, 30. Juni 2017 03:52:58 UTC+2 schrieb da...@lorenso.com:

I’m happy to see you guys so responsive to my feedback. Let’s give that code one more review, however …

try {
// for Node.js
   var autobahn = require('autobahn');
} catch (e) {
// for browsers (where AutobahnJS is available globally)
}
var autobahn = require('autobahn');

I’m not running this in a browser or anything, but I can already tell you it doesn’t work.

Maybe try one more time :slight_smile:

– Dante

On Wednesday, June 28, 2017 at 11:25:43 PM UTC-5, da...@lorenso.com wrote:

So many documentation problems …

  1. trying to run autobahn JS in a browser

Reading up on docs here:

https://github.com/crossbario/autobahn-js

It says: “The code runs unaltered in the browser or Node.js” … except, no it doesn’t.

client.php:41

Uncaught ReferenceError: require is not defined

var autobahn = require(‘autobahn’);

require(…) isn’t working in the browser. Now what? Apparently this code DOESNT run unaltered in a browser.

  1. The Getting Started docs are busted

https://github.com/crossbario/autobahn-js/blob/master/doc/programming.md

"We need to include the Autobahn|JS library in our JavaScript. There are instructions in Getting Started for how

to do this in the browser and in Node.js. This also links to available WAMP routers. In this documentation

use of Crossbar.io is assumed, but examples should work with other routers as well."

Well, clicking on the “Getting Started” link goes to a broken page. I wanted those instructions on getting started in a browser. sigh

BROKEN: https://github.com/crossbario/autobahn-js/blob/master/getting-started.md

– Dante