You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constcote=require('cote');consttimeService=newcote.Responder({name: 'Time Service'});timeService.on('time',(req,cb)=>{console.log('get',req.i)setTimeout(()=>{cb(null,req.i);console.log('return',req.i)},5000)});// graceful shutdownprocess.on('SIGINT',function(){console.log('SIGINT signal received')timeService.close(function(){process.exit(0)})})// graceful shutdownprocess.on('SIGTERM',function(){console.log('SIGTERM signal received')timeService.close(function(){process.exit(0)})})
client.js:
constcote=require('cote');constclient=newcote.Requester({name: 'Client'});leti=0asyncfunctiontest(argument){try{i++console.log('send',i)// body...letres=awaitclient.send({type: 'time', i })console.log('get',res)}catch(e){console.error('??',e)}}setInterval(()=>{test()},1000)
service log:
ime Service > service.online Client#7f0a955b-66ba-4cf4-b780-1525764e2c25
get 1
get 2
get 3
get 4
get 5
get 6
return 1
return 2
get 7
return 3
get 8
return 4
get 9
^CSIGINT signal received
return 5
return 6
return 7
return 8
return 9
ctrl+c shutdown the service, and it will response 5-9 to client. but the client doesn't receive 5-9 data
client log:
Hello! I'm Client#7f0a955b-66ba-4cf4-b780-1525764e2c25
========================
send 1
Client > service.online Time Service#87430ddc-3060-4cb7-aac9-a2ffa5bc4cf8 on 8000
send 2
send 3
send 4
send 5
send 6
get 1
send 7
get 2
get 3
send 8
get 4
send 9
send 10
send 11
send 12
send 13
send 14
send 15
Client > service.offline Time Service#87430ddc-3060-4cb7-aac9-a2ffa5bc4cf8 on 8000
send 16
send 17
send 18
send 19
The text was updated successfully, but these errors were encountered:
service.js:
client.js:
service log:
ctrl+c shutdown the service, and it will response 5-9 to client. but the client doesn't receive 5-9 data
client log:
The text was updated successfully, but these errors were encountered: