@live-change/dao 0.5.20 → 0.5.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,7 +10,6 @@ class LoopbackConnection extends Connection {
10
10
  this.serverMessageListener = null
11
11
  this.serverCloseListener = null
12
12
  this.headers = {}
13
- this.initialize()
14
13
  }
15
14
 
16
15
  next(fn) {
@@ -32,6 +31,7 @@ class LoopbackConnection extends Connection {
32
31
  resolve(true)
33
32
  })
34
33
  })
34
+ return this.initPromise
35
35
  }
36
36
 
37
37
  send(message) {
@@ -1,5 +1,7 @@
1
1
  const ReactiveServerConnection = require('./ReactiveServerConnection.js')
2
2
 
3
+ const debug = require('debug')('dao')
4
+
3
5
  class ReactiveServer {
4
6
  constructor(daoFactory, settings) {
5
7
  this.settings = settings || {}
@@ -11,9 +13,11 @@ class ReactiveServer {
11
13
  let id = ++this.lastConnectionId
12
14
  let reactiveConnection = new ReactiveServerConnection(this, id, connection, this.daoFactory, this.settings)
13
15
  this.connections.set( reactiveConnection.id, reactiveConnection )
16
+ debug("ReactiveServer: new connection", id, 'total', this.connections.size)
14
17
  }
15
18
  handleConnectionClose(reactiveConnection) {
16
19
  this.connections.delete( reactiveConnection.id )
20
+ debug("ReactiveServer: connection closed", reactiveConnection.id, 'total', this.connections.size)
17
21
  }
18
22
  }
19
23
 
package/package.json CHANGED
@@ -35,6 +35,6 @@
35
35
  "scripts": {
36
36
  "test": "NODE_ENV=test blue-tape tests/*"
37
37
  },
38
- "version": "0.5.20",
39
- "gitHead": "36b21b0f5615098306e92ac4b05013f859268efe"
38
+ "version": "0.5.22",
39
+ "gitHead": "c44369e98e27df9f5d09142e6c34d02510b018b1"
40
40
  }
@@ -16,6 +16,7 @@ test("click list", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  let clicksObservable, clicksObserver, ticks = 0
@@ -37,6 +37,7 @@ test("connection monitors", (t) => {
37
37
  })
38
38
  }
39
39
  })
40
+ client.initialize()
40
41
  })
41
42
 
42
43
  t.test('wait 10 ping pongs', (t) => {
@@ -15,6 +15,7 @@ test("time value", (t) => {
15
15
  client = new LoopbackConnection({ sessionId }, server, {
16
16
  delay: 50
17
17
  })
18
+ client.initialize()
18
19
  client.once('authenticationError', (err) => t.pass("authentication failed!"))
19
20
  })
20
21
 
package/tests/get-more.js CHANGED
@@ -16,6 +16,7 @@ test("get more", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  t.test('get users list with one level of dependencies', (t) => {
@@ -16,6 +16,7 @@ test("time value", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  let errorObservable, errorObserver
@@ -22,6 +22,7 @@ test("loopback connection", (t) => {
22
22
  onConnect: () => t.pass("connected"),
23
23
  delay: 50
24
24
  })
25
+ client.initialize()
25
26
  })
26
27
 
27
28
  t.test('get session id', (t) => {
@@ -19,6 +19,7 @@ test('create connection', (t) => {
19
19
  },
20
20
  delay: 50
21
21
  })
22
+ client.initialize()
22
23
  })
23
24
 
24
25
  test('send {type:"get"}', (t) => {
@@ -16,6 +16,7 @@ test("observe more", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  t.test('observe and unobserve users list with no dependencies', (t) => {
@@ -16,6 +16,7 @@ test("time value", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  let errorObservable, errorObserver
@@ -16,6 +16,7 @@ test("time value", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  let timeObservable, timeObserver, ticks = 0
@@ -23,6 +23,7 @@ test("request resend", (t) => {
23
23
  queueRequestsWhenDisconnected: true,
24
24
  queueActiveRequestsOnDisconnect: true
25
25
  })
26
+ client.initialize()
26
27
 
27
28
  counter = client.observable(['test', 'counter'], testServerDao.ObservableCounter)
28
29
  client.request(['test', 'reset'])
@@ -26,6 +26,7 @@ test("time synchronization", (t) => {
26
26
  delay: 50,
27
27
  timeSynchronization
28
28
  })
29
+ client.initialize()
29
30
  })
30
31
 
31
32
  t.test('check if time is synchronized', (t) => {
@@ -16,6 +16,7 @@ test("time value", (t) => {
16
16
  onConnect: () => t.pass("connected"),
17
17
  delay: 50
18
18
  })
19
+ client.initialize()
19
20
  })
20
21
 
21
22
  let timeObservable, timeObserver, ticks = 0