@ -7,6 +7,7 @@ const { rpc } = require('./loki_rpc');
// Will be raised (to 3?) when we get more nodes
// Will be raised (to 3?) when we get more nodes
const MINIMUM _SUCCESSFUL _REQUESTS = 2 ;
const MINIMUM _SUCCESSFUL _REQUESTS = 2 ;
const LOKI _LONGPOLL _HEADER = 'X-Loki-Long-Poll' ;
class LokiMessageAPI {
class LokiMessageAPI {
constructor ( { snodeServerPort } ) {
constructor ( { snodeServerPort } ) {
@ -171,13 +172,20 @@ class LokiMessageAPI {
pubKey : ourKey ,
pubKey : ourKey ,
lastHash : nodeData . lastHash || '' ,
lastHash : nodeData . lastHash || '' ,
} ;
} ;
const options = {
timeout : 40000 ,
headers : {
[ LOKI _LONGPOLL _HEADER ] : true ,
} ,
} ;
try {
try {
const result = await rpc (
const result = await rpc (
` http:// ${ nodeUrl } ` ,
` http:// ${ nodeUrl } ` ,
this . snodeServerPort ,
this . snodeServerPort ,
'retrieve' ,
'retrieve' ,
params
params ,
options
) ;
) ;
nodeComplete ( nodeUrl ) ;
nodeComplete ( nodeUrl ) ;