nknorg / nkn-client-js Goto Github PK
View Code? Open in Web Editor NEW[Deprecated, use nkn-sdk-js instead] JavaScript implementation of NKN client
Home Page: https://www.nkn.org
License: Apache License 2.0
[Deprecated, use nkn-sdk-js instead] JavaScript implementation of NKN client
Home Page: https://www.nkn.org
License: Apache License 2.0
Currently getSubscribers
and some other requests are being directed to the seedRpcServerAddr
that was used in initializing the client.
By default, how about directing those at the node that we are connected to, instead? Is that something we can do without problems?
If that is something that can be done, then in D-Chat I would also configure the wallet to send requests to the same node. It is better that way because you either have everything break down, or everything will work. Currently I see people not getting subscribed to chats, and while it's hard to pinpoint the cause, I think that this could be one of them.
Also, I think dropping "Origin" and "Referer" headers from requests is not a terrible idea if they aren't needed, since some will argue that those lower privacy.
nkn-client-js/lib/protocol/payloads_pb.js
Line 12 in fd88803
Please replace that line with.. say, var global = window;
, as it is the same thing. It causes Firefox to go crazy over CSP. That would save me, and probably others, some headache with browserify and whatnot.
same thing https://github.com/nknorg/nkn-client-js/blob/master/lib/protocol/messages_pb.js#L12
Hi,
The minified browser package for NKN is about 700KB. That's really hefty!
Could something be done to make it, like, 10 times smaller (70KB is still big for a minified js library).
Cheers,
Mark
Hi,
Does client.getSubscription(topic, addr)
have the capability of also fetching from the Tx pool, like getSubscribers
does?
It isn't exposed as an option, and I thought asking was quicker than testing this time.
Hi,
I'm getting this error:
The page at '' was loaded over HTTPS, but requested an insecure resource 'http://mainnet-seed-0001.nkn.org:30003/'. This request has been blocked; the content must be served over HTTPS.
As my site works over https, i can't use the client library currently with the current seed nodes.
Is there an https seed node i can use?
I can proxy one of the seed nodes with nginx, but that only adds delays.
It would be highly preferred if NKN would provide a couple HTTPS nodes as well.
Cheers,
Mark
Hi,
I don't think the publish is working correctly.
const nknWallet = require('nkn-wallet')
const nkn = require('nkn-client')
const wallet = nknWallet.newWallet('pwd')
const client = nkn({
privateKey: wallet.getPrivateKey(),
indentifier: 'client'
})
const receivingClientWallet = nknWallet.newWallet('pwd')
receivingClientWallet.subscribe(
'topic',
0,
10,
'pwd',
'identifier'
)
client.on('connect' , () =>
setTimeout(() => {
client.publish(
'topic',
0,
'hello world'
)
}, 1000)
)
This makes a request where it gets a result like {"id":"1","jsonrpc":"2.0","result":{"identifier.02c988e6a672fd6b8cf42e68682362ee152a8afb5176b9206c558b4cb89daba47d":"","identifier.0352304707e0af0187b435ea5f3ec8f3a0fbac71e3e801dbc34b3cf8d4000d1128":"","identifier.03c7575885c10f141576d817fa5fbca5144e74e3fd85838530ec8a8027d587aa5a":""}}
But then nothing gets sent to them afterwards. My understanding was that it is a shortcut to send the message to all those addresses automatically.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.