pouchdb-community / socket-pouch

PouchDB and CouchDB over WebSockets, using Engine.io
Apache License 2.0
207 stars 45 forks source link

Error: xhr poll error #22

Open beegmon opened 8 years ago

beegmon commented 8 years ago

Hello,

I am more than certain I am doing something dumb but I can't seem to figure out what my issue might be.

I have a pretty simply setup:

pouch_proxy.js -- proxies to couchDB (which has all auth turned off right now): ` const socketPouchServer = require('socket-pouch/server');

socketPouchServer.listen(80, {remoteUrl: 'http://127.0.0.1:5984'}, function () { console.log('PouchDB Proxy Started Pointed at LocalHost CouchDB'); }); `

pouch.js -- Client that a remoteDB and attempts grab all the docs from it: ` const PouchDB = require('pouchdb'); PouchDB.adapter('socket', require('socket-pouch/client'));

const remoteDB = new PouchDB('new_gdax_limit_events', { adapter: 'socket', url: 'ws://127.0.0.1:80', });

remoteDB.allDocs({ include_docs: true }).then(function (result) { console.log(result); }).catch(function (err) { console.log(err); }); `

The resulting output from pouch.js is: { [Error: xhr poll error] type: 'TransportError', description: 503 }

Running pouch.js with debug gives me: pouchdb:socket:client constructor called +0ms { adapter: 'socket', url: 'ws://127.0.0.1:80', name: '_pouch_new_gdax_limit_events' } { [Error: xhr poll error] type: 'TransportError', description: 503 }

When running pouch_proxy.js with debug I get no output.

Any hints as to what I might be doing wrong? I can connect to the couchDB on localhost:5984 and the DB being called by the client exists and is full of docs.

Thanks!

beegmon commented 8 years ago

Update: I figured out the Xhr error (wasn't listening on the port I thought I was). However, now my client produces this message:

[root@centos pouch_test]# DEBUG=pouchdb:socket:* node pouch.js pouchdb:socket:client constructor called +0ms { adapter: 'socket', url: 'ws://localhost:80', name: '_pouch_new_gdax_limit_events' } pouchdb:socket:client socket opened +126ms PpoZW82qdZQA1y_lAAAG undefined pouchdb:socket:client send message +2ms PpoZW82qdZQA1y_lAAAG 533A8E28-0107-4AF9-9240-ED3D9DB4799F createDatabase [ { name: undefined, auto_compaction: false } ] pouchdb:socket:client message sent +4ms PpoZW82qdZQA1y_lAAAG 533A8E28-0107-4AF9-9240-ED3D9DB4799F pouchdb:socket:client receive message +68ms PpoZW82qdZQA1y_lAAAG 533A8E28-0107-4AF9-9240-ED3D9DB4799F 0 { error: 'you must provide a database name' } { error: 'you must provide a database name' }

nolanlawson commented 8 years ago

Have you tried looking at the unit tests to see how they work? If you can get those running on your machine (which should be as easy as npm install and npm run dev) then you can confirm what code is necessary in order to get this module to work. Otherwise from looking at the information provided it's difficult for me to provide guidance...