Code Monkey home page Code Monkey logo

ssb-client's People

Contributors

arj03 avatar christianbundy avatar cryptix avatar dangerousbeans avatar dominictarr avatar mixmix avatar mmckegg avatar nichoth avatar pfrazee avatar qypea avatar regular avatar rickcarlino avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssb-client's Issues

WebSocket closes after idling

I have an app connecting on my local computer which will do some work on sbot, then idle until the user does something. After 30s, the websocket connection closes.

I checked the logs, and it doesn't look like the close is initiated by sbot or the app. I think this is a choice by the browser (or possibly server code) to disconnect. TCP keepalive isn't used in Websockets, you have to send ping/pong messages to keep it active.

The app could listen for closes and reconnect. This line before any activity also works:

if (client.closed)
    client.reconnect().auth(SSBKeys.createAuth(user.keys))

But I don't like having to do that in every application. It also closes any live streams, so they have to be re-initialized.

This does work as a keepalive:

setInterval(function () {
  console.log('ping')
  ssb.whoami()
}, 15e3)

Do we want to consider a ping method in the ssb api? What's the best way to deal with this?

Why are all fields mandatory in the custom client?

Problem: I just want to change my remote, but SSB-Client requires that I specify my keys, caps, manifest, etc., because these fields are mandatory in the custom client.

Solution: Let's just use the defaults unless they're specified?

separate crypto code?

I'm thinking that maybe we shouldn't mix crypto code with networking code.
If you pass you keys to it it needs to be audited, we want to minimize that. maybe it's better to make this just be about getting an rpc connection and then having another part to manage creating the messages.

Also, I noticed that this publish implementation will not work if you call it in parallel,
but the implementation in https://github.com/ssbc/secure-scuttlebutt/blob/master/feed.js
does queue it so you can call feed.add as many times as you like.

TODO: Documentation Drive

rate the current state of the documentation out of 10.

  • 7 ?? just briefly looking over it. looks pretty ok.

is it clear what this is used for? is anything confusing or weird?

  • what's an rpc connection?? ooh found it. shall make a link to it and do a PR.

is there api documentation?

  • yes

read code, do you see any undocumented methods?

  • no. though some of the code flies over my head... re: sbot/MultiServer? I see some to do comments there.

for a method is there any undocumented options?

  • no.

If you make changes, give a new rating.
7.5. I'm going to run through Mix's tutorial for basic client and see if I can understand more of what's going on. :)

TypeError: cb is not a function

I've started getting this error in minbase since upgrading to [email protected]. It seems to track back to the blobs logic in ssb-client. Downgrading to the previous version appears to solve the issue.

The error:

cb is not a function
TypeError: cb is not a function`
    at file:///home/ev/minbase/build/index.html:14211:11
    at file:///home/ev/minbase/build/index.html:9766:14
    at file:///home/ev/minbase/build/index.html:9715:14
    at file:///home/ev/minbase/build/index.html:9707:5
    at file:///home/ev/minbase/build/index.html:9756:17
    at file:///home/ev/minbase/build/index.html:11229:24
    at file:///home/ev/minbase/build/index.html:11451:7
    at next (file:///home/ev/minbase/build/index.html:11225:11)
    at sink (file:///home/ev/minbase/build/index.html:11246:9)
    at sink (file:///home/ev/minbase/build/index.html:9758:7)

Which leads to the cb(err, actualHash) in blobs.js

Not sure how to fix? cc @regular

Unable to install

Fails while attemping to install. Any help is appreciated!

NPM version 6.4.1
Node version 10.15.3

{Project Directory}\node_modules\secret-handshake\node_modules\sodium-native\d
eps\libsodium>del tmp tmp2 tmp3
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: spawn C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp-build "node preinstall.js" "node postinstall.js"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

WARNING - nasty little patch

this commit ce09df1
probably shouldn't have been a patch level change @dominictarr

It fundamentally changes the expectations of ssb-client options:

  • removes default scuttleverse cap (how are people now supposed to know this @cryptix ?)
    • for the record : 1KHLiKZvAvjbY1ziZEHMXawbCEIM6qwjCDm3VYRan/s=
  • demands a new config option present: config.caps.shs

no sbot.private function

Hi,

When using sbot.private.publish(etc), with sbot being ssbClient(function (err, sbot) {blabla}) I get this error:

(node:41004) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'publish' of undefined
(node:41004) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

And when loging sbot.private, I get undefined, and when loging sbot object I don't find the private function.

Am I missing something?

Thanks in advance

hard to automate ssb-client with sbot

sbot server by default binds to global ip address to listen
ssbClient by default connects to localhost

this makes it difficult to automatically start a server and use it.

No way to see connection status

It would be useful for ssb-client to have something you can look at to see if it's actually connected, or a mechanism to auto-reconnect maybe

setting manual config options seems to be broken

ssbClient(keys, 'appname') works fine, however if you are wanting to pass your own config in (e.g. ssbClient(keys, ssbConfig('appname', { port: 12345 }))), everything breaks.

It seems there is something fishy going on here.

config is set to {} and the options are basically thrown away.

hardcoded appKey

I want to use ssb-client without passing keys or opts, like this:

// $ export ssb_appname=testing

ssbClient((err, sbot) => {
 // fails to connect because it uses .testing/config but not the appKey/shs  caps
})

It should use ssb-config which checks ssb_appname. In that case ssb-client falls back to the still hardcoded caps..

I saw #15 and wonder if we can merge a rebased version of it? or say that if you supply opts it has to have appKey? All the cases juggling between opts and config make my head spin...

Error: method is not in list of allowed methods

There are several modules intertwined here, so I'm posting this here since this I think is the top module in the dependency graph I think.

This is me trying to start a ssb-server2 module, being a library that provides a CLI interface and daemon-like process for ssb, like ssb-server.

I started by more-or-less copying the structure of ssb-server -- https://github.com/planetary-social/ssb-server2/blob/efbbe600294695893551384981a6faa771a5091d/bin.js#L99

The call to ssb-client:

    Client(config.keys, opts, (err, rpc) => {

However I am stuck with this error when I start the server then try calling a method:

  stack: 'Error: method:db,getStatus is not in list of allowed methods\n' +

This is after running NODE_ENV=test node ./bin.js start -- --path=./test-data in one terminal, then doing NODE_ENV=test node ./bin.js db.getStatus -- --path=./test-data in another terminal.

I feel like I need to do something with secret-handshake in order for this to work, but I'm not sure.

manifest.json in the browser

I'm trying to run this in the browser, but it's failing when it can't find manifest.json. Is there a known workaround for this? I'm sure the fs.readFileSync() is being polyfilled, but I'm unsure how to actually generate manifest.json. Thanks!

no sbot.on('close') event?

I see an sbot.closed flag, and there's a sbot.on which adds to sbot._events, but it doesn't seem as though anything gets fired when closed changes from false -> true.

I can work around this with a setInterval, but if this functionality exists I'd rather use it. Am I missing something?

ReferenceError: explain is not defined

New in 4.7.0?

ReferenceError: explain is not defined
    at /home/christianbundy/src/redacted/node_modules/ssb-client/client.js:69:13
    at /home/christianbundy/src/redacted/node_modules/multiserver/compose.js:80:24
    at onConnect (/home/christianbundy/src/redactednode_modules/multiserver/plugins/ws.js:93:11)
    at WebSocket.<anonymous> (/home/christianbundy/src/redactednode_modules/pull-ws/source.js:49:13)
    at WebSocket.onError (/home/christianbundy/src/redacted/node_modules/ws/lib/WebSocket.js:452:14)
    at WebSocket.emit (events.js:197:13)
    at ClientRequest.onerror (/home/christianbundy/src/redacted/node_modules/ws/lib/WebSocket.js:711:10)
    at ClientRequest.emit (events.js:197:13)
    at Socket.socketErrorListener (_http_client.js:397:9)
    at Socket.emit (events.js:197:13)

combine auth and connect?

What would you think of putting the .auth call into .connect, and having the auth object be passed into .connect? So:

var client = SSBClient({ host: 'localhost' })
client.connect(abortIf)
client.auth(SSBKeys.createAuth(keys), abortIf)

becomes

var client = SSBClient({ host: 'localhost' })
client.connect(SSBKeys.createAuth(keys), abortIf)

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.