909 Commits

Author SHA1 Message Date
Mark Nadal
baf99d7e72 Update client.js 2017-01-11 10:47:50 -08:00
Mark Nadal
8c426553d7 Update gun.js 2017-01-11 10:38:10 -08:00
Mark Nadal
bd0e6a615f Update gun.js 2017-01-03 09:40:47 -08:00
Mark Nadal
de9c6ce1ae Merge branch '0.5' of https://github.com/amark/gun into 0.5 2016-12-30 19:23:20 -08:00
Mark Nadal
7291263426 repull and test 2016-12-30 19:23:16 -08:00
Mark Nadal
c6a75748d2 Merge pull request #300 from d3x0r/patch-7
Add example with external websocket provider
2016-12-27 00:14:48 -07:00
Mark Nadal
63af616033 Update http-external-ws.js 2016-12-26 23:13:02 -08:00
d3x0r
f9a851c73a Apply gun 'out' listener once 2016-12-26 23:10:58 -08:00
Mark Nadal
d5cf9938c1 Update file.js 2016-12-26 22:48:59 -08:00
Mark Nadal
2e826ca9d8 fix reads 2016-12-26 22:46:27 -08:00
d3x0r
4a5ab4122b Update http-external-ws.js
use classic functions instead of es6
fix peers.find should be peers.findIndex for splice.
2016-12-26 22:33:46 -08:00
Mark Nadal
096e224af5 Merge pull request #298 from d3x0r/patch-6
#297 passing options to websocket
2016-12-26 22:50:28 -07:00
d3x0r
85ae140512 HTTP.js example with external in/out used
Connects server websocket by event to gun....  (would have complicated with alternative websocket interfaces and protocol handlings... but left some comments about that)
2016-12-26 21:49:42 -08:00
Mark Nadal
db74549326 warning: file.js/data.json is for local development testing only. 2016-12-26 21:12:21 -08:00
d3x0r
a4425bda24 remove redundant option fetch
since options have to be fetched higher anyway... 
Or rather - this options is outside of knowing gun options
2016-12-23 00:43:05 -08:00
d3x0r
266b18109c Missed a change to get the options....
Somehow my other options test didn't work... had to add something like this.

Now I feel this is such a huge hack
2016-12-23 00:35:11 -08:00
Mark Nadal
eddbbf6247 Merge pull request #297 from d3x0r/patch-5
pass gun's options to websocket
2016-12-22 23:01:12 -07:00
d3x0r
751ac3b230 pass wsc options to client gun create ( wsc:protocols especially, since that translates to the optional parameter in the standard client websocket constructor ) 2016-12-21 15:03:10 -08:00
d3x0r
8dac820902 fix default assignment 2016-12-21 12:18:39 -08:00
d3x0r
8e6d827216 fix indentation 2016-12-21 12:17:56 -08:00
d3x0r
9c41182004 Fix quotes 2016-12-21 12:17:31 -08:00
d3x0r
320183fa54 Set default options more robustly 2016-12-21 12:17:01 -08:00
d3x0r
f28b62fd4c Setup default option
if wsc doesn't previosuly exist, create a empty option block.
add option 'protocols' for wsc that can specify the optional protocols before the options.
Options will also only apply to node client websockets; (package 'ws'), browser websockets only take 1 with 1 optional parameter (being the list of protocols to connect with; so I added that optional param for compatibility.
2016-12-21 12:09:10 -08:00
d3x0r
f548db293b pull opions from 'wsc' in gun options
'ws' options are used by server
'wsc' options to be used by websock client... ?
2016-12-21 11:59:28 -08:00
d3x0r
e8f840c548 pass gun's options to websocket
I recently had to set options given to the websocket client especially 

rejectUnauthorized {Boolean} Verify or not the server certificate.

for connecting to wss which are using self signed certs...
could also pass things like 'protocol' to differentiate a Gun websocket connection from some other websocket connection....

I don't know if maybe websock options should be a object in options instead ?  To avoid namespace collision?
2016-12-21 11:21:13 -08:00
Mark Nadal
631eb6d023 mostly working solution to orphan-child-unsubscribe-from-table problem, although causality questions, going to try another idea. 2016-12-19 23:58:30 -08:00
Mark Nadal
2e7b87c3b9 Update gun.js 2016-12-19 20:57:07 -08:00
Mark Nadal
44fa4f3252 Update gun.js 2016-12-19 20:30:42 -08:00
Mark Nadal
5ade1b6773 idea for solution 2016-12-17 23:54:32 -08:00
Mark Nadal
bdcea8c0d1 Update gun.js 2016-12-17 21:56:15 -08:00
Mark Nadal
ef89785525 Update gun.js 2016-12-17 14:01:58 -08:00
Mark Nadal
53d5417d4a Update gun.js 2016-12-17 12:25:36 -08:00
Mark Nadal
ca30236be5 Merge pull request #296 from PsychoLlama/0.5
0.5: fix common travis-ci build failures
2016-12-16 16:24:35 -07:00
Jesse Gibson
778682821a Reverting mocha update
A nested dependency in 3.2.0 is using a version selector npm doesn't
support. Another build broke. This commit reverts the update.
2016-12-16 12:02:16 -07:00
Jesse Gibson
e0fa5ff0d5 Update mocha to 3.2.0
Attempt to fix build #650.1
For more details, read
https://github.com/amark/gun/pull/296#issuecomment-267665038
2016-12-16 11:39:24 -07:00
Jesse Gibson
e6539a2ba7 Fix npm version selector
Older versions of npm don't support the caret version selector, which
seems to be failing Travis-CI gun build 649.1 & 649.2.
I've switched it to a more backwards-compatible version selector.
Sadly, I can't test if it works on my machine, since the node install
seems to fail on all versions prior to v4. Travis will just need to tell
us :)
2016-12-16 11:15:17 -07:00
Jesse Gibson
25328d14b8 Fix common travis-ci build failures
Move E2E panic tests into their own dedicated folder so mocha won't
automatically attempt to run it. New npm script (`npm run e2e`) runs
those tests with mocha explicitly.

This solves a number of problems:
- Travis-CI can't run the panic tests without a selenium server, which
  requires a ton more setup that simply hasn't been done yet.
- Selenium-webdriver doesn't support node < v4, and immediately fails
  the build on those environments.

If at any point in the future we want those tests to run automatically,
here's what we'll need:
- Browserstack or SauceLabs tunneling and auth env variables.
- Bash script to detect node version and only install deps and run the
  tests if the environment supports it.

Also, a number of tests had `.only` in front, preventing all the others
from running. They've been removed.
2016-12-16 10:57:31 -07:00
Jesse Gibson
09f8f37beb Fix unbuild .gitignore
Running the unbuild step wipes out the src/.gitignore file. Instead,
now the root .gitignore file is told to ignore src/.
Prevents a scenario where you run unbuild, it wipes out the .gitignore
file, and `git status` shows all the new src files as untracked. A
developer could accidentally commit them without realizing it.
2016-12-16 10:27:49 -07:00
Mark Nadal
02381a123d so much 2016-12-15 16:17:50 -08:00
Mark Nadal
ad345582aa Merge pull request #294 from PsychoLlama/0.5
Shallow copy constructor options
2016-12-15 15:46:18 -07:00
Jesse Gibson
a566572a2d Shallow copy constructor options
Previously constructor options were deeply copied, which caused
issues with 3rd party plugins when they pass "class" instances as
options (since instances were copied into POJOs, breaking the prototype
chain). Now it's shallow copied. Special treatment is still given for
the `peers` property.
2016-12-15 15:35:11 -07:00
Mark Nadal
90f0d7f687 Merge pull request #292 from PsychoLlama/0.5
0.5: make the websocket logic more robust
2016-12-13 15:43:04 -05:00
Jesse Gibson
ba673f73f8 Attempt reconnect on disconnect
Previously, the client websocket layer would only attempt a reconnection
if there were pending messages in the queue. Now it will always attempt
a reconnection, solving most of issue #259 (although not completely, as
reconnects are susceptible to race conditions).
2016-12-13 13:37:43 -07:00
Jesse Gibson
304265e193 Pass backoff options from constructor
The Client constructor supports backoff configuration. This commit
exposes it to the end developer via the `peers` options object, in the
`backoff` property.
Example:

Gun({
  peers: {
    'url.com/gun': {
      backoff: { max: 1000, factor: 0.2 }
    }
  }
})
2016-12-12 16:24:51 -07:00
Jesse Gibson
30fe844cab Check JSON support just once
Two separate modules (localStorage & websockets) ensured JSON was
globally defined. Since only one is needed to alert the user, the
other has been removed.
2016-12-12 16:10:39 -07:00
Jesse Gibson
bb65acab10 Merge branch '0.5' of https://github.com/amark/gun into 0.5 2016-12-12 15:12:41 -07:00
Jesse Gibson
01c93157cb Fix msg passing, add reconnect & backoff
Fixed broadcast storm caused by re-enveloping the same message and
re-emitting it (I passed the envelope to gun, not just the msg body).
Sockets will attempt an exponential reconnect if the message queue isn't
empty, otherwise they're still just lazy bums that only open when
needed.
JSONP wasn't working before I took on this project, but now it's
completely disconnected. Once it's working, it should go in the
`request` function as a websocket fallback.
2016-12-12 14:37:09 -07:00
Mark Nadal
9f7acfd27f Merge branch '0.5' of https://github.com/amark/gun into 0.5 2016-12-09 18:20:45 -08:00
Mark Nadal
0779e32544 merged? Maybe? 2016-12-09 18:20:16 -08:00
Mark Nadal
69d1e81fc9 Update gun.js 2016-12-09 18:13:25 -08:00