dominictarr / level-live-stream

MIT License
80 stars 11 forks source link

Error: not supported #20

Closed kirbysayshi closed 8 years ago

kirbysayshi commented 8 years ago

No matter what I do I seem to always receive the following error when using multilevel:

/Users/drewp/Dropbox/js/dataminer/node_modules/multilevel/lib/client.js:107
  if (allowed.indexOf(ev) == -1) throw new Error('not supported');
                                 ^

Error: not supported
    at Db.addEventListener.Db.on (/Users/drewp/Dropbox/js/dataminer/node_modules/multilevel/lib/client.js:107:40)
    at post (/Users/drewp/Dropbox/js/dataminer/node_modules/level-post/index.js:56:6)
    at exports.live (/Users/drewp/Dropbox/js/dataminer/node_modules/pull-level/index.js:22:17)
    at Object.exports.read.exports.readStream.exports.createReadStream (/Users/drewp/Dropbox/js/dataminer/node_modules/pull-level/index.js:50:37)
    at module.exports (/Users/drewp/Dropbox/js/dataminer/node_modules/level-live-stream/index.js:14:35)
    at Db.db.liveStream.db.createLiveStream (/Users/drewp/Dropbox/js/dataminer/node_modules/level-live-stream/index.js:25:14)
    at Object.<anonymous> (/Users/drewp/Dropbox/js/dataminer/examples/sw-saber-miner.js:21:4)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)

Relevant code:

// digger.js
var path = require('path');
var net = require('net');
var level = require('level');
var multilevel = require('multilevel/msgpack');
var LevelLiveStream = require('level-live-stream');

var dbpath = path.join(__dirname, path.basename(__filename, '.js') + '.db');
var db = level(dbpath, {
  createIfMissing: true,
  valueEncoding: 'json'
});

LevelLiveStream.install(db);

net.createServer(con => {
  con
    .pipe(multilevel.server(db))
    .pipe(con);
}).listen(3000);

multilevel.writeManifest(db, __dirname + '/manifest.json');

// ...code that puts a bunch
db.put( 'twitter:' + tweet.id_str, { tweet: tweet, sentiment: 0 });
// miner.js
var path = require('path');
var net = require('net');
var multilevel = require('multilevel/msgpack');
var LevelLiveStream = require('level-live-stream');

var manifest = require('./manifest.json');

var db = multilevel.client(manifest);
var con = net.connect(3000);

LevelLiveStream.install(db);

con
  .pipe(db.createRpcStream())
  .pipe(con);

db.createLiveStream().on('data', console.log.bind(console));

And I've verified that my manifest.json loads and does have createLiveStream/liveStream added to it.

Also tried without the manifest and still got the same error.

Relevant packages:

$ npm ls | grep level
├─┬ level@1.4.0
│ ├─┬ level-packager@1.2.0
│ │ └─┬ levelup@1.3.1
│ │   ├── deferred-leveldown@1.2.1
│ │   ├── level-codec@6.1.0
│ │   ├── level-errors@1.0.4
│ │   ├── level-iterator-stream@1.3.1
│ └─┬ leveldown@1.4.3
│   ├── abstract-leveldown@2.4.1
├─┬ level-live-stream@1.4.11
│ ├─┬ level-sublevel@6.3.17
│ │ ├─┬ levelup@0.19.0
│ │ │ ├─┬ deferred-leveldown@0.2.0
│ │ │ │ └─┬ abstract-leveldown@0.12.4
│ ├─┬ pull-level@1.4.1
│ │ ├─┬ level-post@1.0.4
├─┬ multilevel@7.2.2
│ ├─┬ level-manifest@1.2.0

Please let me know if there are any more details I can provide!

dominictarr commented 8 years ago

you don't need to install it on the client - just install it on the server before you connect generate the manifest

kirbysayshi commented 8 years ago

@dominictarr oh.

:sweat_smile:

Eeesh sorry for not understanding that.

Thanks for your help!