Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "TypeError: $.hubConnection[("createConstellation" + type)] is not a function" with example #1

Closed
j0nathan33 opened this issue Jul 30, 2017 · 1 comment

Comments

@j0nathan33
Copy link
Contributor

j0nathan33 commented Jul 30, 2017

J'essaye de faire fonctionné un script nodejs avec constellation mais ça me donne l'erreur suivants :

TypeError: $.hubConnection[("createConstellation" + type)] is not a function
    at ConstellationContext.createHub (/tmp/test/node_modules/constellation-nodejs/lib/constellation.js:126:77)
    at ConstellationContext.getControllerHub (/tmp/test/node_modules/constellation-nodejs/lib/constellation.js:140:21)
    at ctx.init.then (/tmp/test/node_modules/constellation-nodejs/index.js:24:28)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

Mon script (Exemple dans le readMe) :

 var ConstellationHub = require('constellation-nodejs');

  //// Without configuration file 
  var c = new ConstellationHub("test", "test", "AmbientSensor", "1.8.2"); //// AmbientSensor represents the name of the application (package)

  //// Create a Controller Hub
  c.Controller()
    .then((ctx) => {
      ctx.on('connected', () => { 
        console.log("CONNECTED"); 
        //ctx.hub.server.writelog("SentinelPI", "{ 'test' : 'ok' } "); 
      });
      return ctx.connect();
    });

  //// Create a Consumer Hub
  c.Consumer()
    .then((ctx) => {
      ctx.on('connected', () => { 
        console.log("CONNECTED"); 
        //// subscribe
        ctx.hub.client.registerStateObjectLink("R2D2", "Vera", "Flood Sensor (temperature)", "*", function (so) {
          console.log(so.Value.Temperature);
        });
      });
      return ctx.connect();
    });

  //// Create a Sentinel Hub
  c.Sentinel("Corulag")
    .then((ctx) => {
      ctx.on('connected', () => { 
        console.log("CONNECTED"); 
        ctx.hub.server.writelog("SentinelPI", "{ 'test' : 'ok' } "); 
      });
      return ctx.connect();
    });

J'utilise la version 8.2.1 de node et 5.3.0 de npm. De plus, j'ai essayé avec une anciens version de node(6.11.1) et j'ai toujours la même erreur. Pour l'éxécution, je fait "node test.js"

@gclem gclem closed this as completed in b74afc1 Jul 30, 2017
@gclem
Copy link
Collaborator

gclem commented Jul 30, 2017

Fixed,

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants