Giter Site home page Giter Site logo

Comments (13)

hugohenrique avatar hugohenrique commented on May 8, 2024

Yes the error continues. Seems to me that in the new version ends this problem.

from autobahn-js.

nlegoff avatar nlegoff commented on May 8, 2024

I looked at the source code and it seems that there is two problems

  • The autobahn.js file defines two modules (autobahn & when) which is forbidden. There should only be one module definition per file on disk.
  • Some methods of the "autobahn object" are defined outside the module definition.

from autobahn-js.

nlegoff avatar nlegoff commented on May 8, 2024

@oberstet

Currently AMD loading can not work as it is.

The simplest solution to this problem would be to build two file :

  • autobahn.js (with when.js)
  • autobahn.amd.js (without when.js)

The autobahn.js file can be provided in a single file with when module inside nevertheless we must point out that the "exports" feature in requireJS would not work as expected due to the when module definition see http://requirejs.org/docs/api.html#config-shim

    require.config({
        baseUrl: ".",
        paths: {
            "autobahn": "//autobahn.s3.amazonaws.com/js/autobahn"
        },
        shim: {
            "autobahn": {
                exports: 'ab'
            }
        }
    });

The autobahn.amd.js would not include include when module and therefore would require when as a module dependency in the require.js configuration.

require.config({
        baseUrl: ".",
        paths: {
            "autobahn": "//autobahn.s3.amazonaws.com/js/autobahn",
            "when": "//cdnjs.cloudflare.com/ajax/libs/when/2.7.1/when"
        },
        shim: {
            "autobahn": {
                deps: ["when"]
            }
        }
    });

What do you think about it ?

from autobahn-js.

oberstet avatar oberstet commented on May 8, 2024

Are you having the issue with the old WAMP v1 implementation?

https://github.com/tavendo/AutobahnJS/tree/wamp1
https://autobahn.s3.amazonaws.com/js/autobahn.js

or the new AutobahnJS for WAMP v2

https://github.com/tavendo/AutobahnJS
https://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.js

?

The new AutobahnJS is built for browsers using Browserify. The old AutobahnJS did include manual code trying to make it compatible with usual module systems.

from autobahn-js.

oberstet avatar oberstet commented on May 8, 2024

If this refers to the old AutobahnJS (WAMPv1) implementation: this is no longer supported anyway. If the issue is for the new implementation, please reopen ..

from autobahn-js.

galthron avatar galthron commented on May 8, 2024

Ive got the same error. Any solution ? I think i tried every possible configuration. I tried to use autobahn directly from autobahn.s3.amazonaws.com/js/autobahn and also i installed it through bower. In first case ive got an error "ReferenceError: ab is not defined" and in second case its seem that there is e problem with loading "submodules" as when and session and the other that are required by autobahn. "ReferenceError: module is not defined module.exports = require('./lib/autobahn');" so it look like there is problem with module.export. I tried to load all libs manually without any success. I will be very very gratefull for any advice , how to run autobahn with requirejs , it took me too much time already. Btw. i`m using the newest version.

from autobahn-js.

oberstet avatar oberstet commented on May 8, 2024

this works for me: https://github.com/tavendo/AutobahnJS/blob/master/package/test/test_require.html

from autobahn-js.

oberstet avatar oberstet commented on May 8, 2024

this also works: https://github.com/tavendo/AutobahnJS/blob/master/package/test/test_require2.html

I've added this info to the readme: https://github.com/tavendo/AutobahnJS#amd-and-requirejs

from autobahn-js.

galthron avatar galthron commented on May 8, 2024

Thanks. That works. But there is another issue. Im using Rachet(http://socketo.me/) Wamp, and ive got this error: Protocol violation: unexpected message type 0, server response is
[0, "5313c015641d6", 1, "Ratchet/0.3"],
i did a little check and it look like 0 (first in array) in Ratchet is Welecome message, but in autobahn is 2 (but i`m not sure is this is a problem). I wonder is that have something to do witch autobahn update to v2. Or maybe problem is somewhere else.

from autobahn-js.

oberstet avatar oberstet commented on May 8, 2024

Probably Ratchet is not yet on version 2 of WAMP ..

from autobahn-js.

cboden avatar cboden commented on May 8, 2024

Ratchet is still on v1. You should use the AutobahnJS version that is compatible with v1 of the WAMP protocol.

from autobahn-js.

oberstet avatar oberstet commented on May 8, 2024

@galthron In this case, you should use:

https://github.com/tavendo/AutobahnJS/tree/wamp1
https://autobahn.s3.amazonaws.com/js/autobahn.js

@cboden Any plans to upgrade Ratchet to v2?

from autobahn-js.

cboden avatar cboden commented on May 8, 2024

I do plan to. I just haven't had much time for OS lately, unfortunately.

from autobahn-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.