Skip to content

Commit

Permalink
test on Node 17
Browse files Browse the repository at this point in the history
  • Loading branch information
Unitech committed Oct 22, 2021
1 parent 318676a commit aca7d0b
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
1 change: 1 addition & 0 deletions .travis.yml
@@ -1,5 +1,6 @@
language: node_js
node_js:
- "17"
- "16"
- "14"
- "12"
Expand Down
9 changes: 9 additions & 0 deletions examples/send-msg/pm2-app.js
@@ -0,0 +1,9 @@

process.on('message', function(packet) {
process.send({
type : 'process:msg',
data : {
success : true
}
});
});
29 changes: 29 additions & 0 deletions examples/send-msg/pm2-msg.js
@@ -0,0 +1,29 @@

const pm2 = require('../..')

console.log(pm2)

pm2.connect(function() {
pm2.sendDataToProcessId({
// id of procces from "pm2 list" command or from pm2.list(errback) method
id : '1',

// process:msg will be send as 'message' on target process
type : 'process:msg',

// Data to be sent
data : {
some : 'data'
},

topic: true
}, function(err, res) {
})
})

// Listen to messages from application
pm2.launchBus(function(err, pm2_bus) {
pm2_bus.on('process:msg', function(packet) {
console.log(packet)
})
})
16 changes: 16 additions & 0 deletions examples/send-msg/t2.js
@@ -0,0 +1,16 @@

var tx2 = require('tx2')
var http = require('http')

var meter = tx2.meter({
name : 'req/sec',
samples : 1,
timeframe : 60
})

http.createServer(function (req, res) {
meter.mark()
res.writeHead(200, {'Content-Type': 'text/plain'})
res.write('Hello World!')
res.end()
}).listen(6001)

0 comments on commit aca7d0b

Please sign in to comment.