Được TopGit lập chỉ mục từ metadata GitHub: Unitech/pm2-axon có 24 sao, viết chủ yếu bằng JavaScript.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
var axon = require('axon');
var sock = axon.socket('push');
sock.bind(3000);
console.log('push server started');
setInterval(function(){
sock.send('hello');
}, 150);
Receiver of PushSocket messages:
var axon = require('axon');
var sock = axon.socket('pull');
sock.connect(3000);
sock.on('message', function(msg){
console.log(msg.toString());
});
Both PushSockets and PullSockets may .bind() or .connect(). In the
following configuration the push socket is bound and pull "workers" connect
to it to receive work:
This configuration shows the inverse, where workers connect to a "sink"
to push results:
Pub / Sub
PubSockets send messages to all subscribers without queueing. This is an
important difference when compared to a PushSocket, where the delivery of
messages will be queued during disconnects and sent again upon the next connection.
var axon = require('axon');
var sock = axon.socket('pub');
sock.bind(3000);
console.log('pub server started');
setInterval(function(){
sock.send('hello');
}, 500);
SubSocket simply receives any messages from a PubSocket:
var axon = require('axon');
var sock = axon.socket('sub');
sock.connect(3000);
sock.on('message', function(msg){
console.log(msg.toString());
});
SubSockets may optionally .subscribe() to one or more "topics" (the first multipart value),
using string patterns or regular expressions:
var axon = require('axon');
var sock = axon.socket('sub');
sock.connect(3000);
sock.subscribe('user:login');
sock.subscribe('upload:*:progress');
sock.on('message', function(topic, msg){
});
Req / Rep
ReqSocket is similar to a PushSocket in that it round-robins messages
to connected RepSockets, however it differs in that this communication is
bi-directional, every req.send()must provide a callback which is invoked
when the RepSocket replies.
var axon = require('axon');
var sock = axon.socket('req');
sock.bind(3000);
sock.send(img, function(res){
});
RepSockets receive a reply callback that is used to respond to the request,
you may have several of these nodes.
var axon = require('axon');
var sock = axon.socket('rep');
sock.connect(3000);
sock.on('message', function(img, reply){
// resize the image
reply(img);
});
Like other sockets you may provide multiple arguments or an array of arguments,
followed by the callbacks. For example here we provide a task name of "resize"
to facilitate multiple tasks over a single socket:
var axon = require('axon');
var sock = axon.socket('req');
sock.bind(3000);
sock.send('resize', img, function(res){
});
Respond to the "resize" task:
var axon = require('axon');
var sock = axon.socket('rep');
sock.connect(3000);
sock.on('message', function(task, img, reply){
switch (task) {
case 'resize':
// resize the image
reply(img);
break;
}
});
PubEmitter / SubEmitter
PubEmitter and SubEmitter are higher-level Pub / Sub sockets, using the "json" codec to behave much like node's EventEmitter. When a SubEmitter's .on() method is invoked, the event name is .subscribe()d for you. Each wildcard (*) or regexp capture group is passed to the callback along with regular message arguments.
app.js:
var axon = require('axon');
var sock = axon.socket('pub-emitter');
sock.connect(3000);
setInterval(function(){
sock.emit('login', { name: 'tobi' });
}, 500);
logger.js:
var axon = require('axon');
var sock = axon.socket('sub-emitter');
sock.bind(3000);
sock.on('user:login', function(user){
console.log('%s signed in', user.name);
});
sock.on('user:*', function(action, user){
console.log('%s %s', user.name, action);
});
sock.on('*', function(event){
console.log(arguments);
});
Socket Options
Every socket has associated options that can be configured via get/set.
identity - the "name" of the socket that uniqued identifies it.
retry timeout - connection retry timeout in milliseconds [100] (0 = do not reconnect)
retry max timeout - the cap for retry timeout length in milliseconds [5000]
hwm - the high water mark threshold for queues [Infinity]
Binding / Connecting
In addition to passing a portno, binding to INADDR_ANY by default, you
may also specify the hostname via .bind(port, host), another alternative
is to specify the url much like zmq via tcp://<hostname>:<portno>, thus
the following are equivalent:
Axon 2.x uses the extremely simple AMP protocol to send messages on the wire. Codecs are no longer required as they were in Axon 1.x.
Performance
Preliminary benchmarks on my Macbook Pro based on 10 messages
per tick as a realistic production application would likely have
even less than this. "better" numbers may be acheived with batching
and a larger messages/tick count however this is not realistic.
Axon are not meant to combat zeromq nor provide feature parity,
but provide a nice solution when you don't need the insane
nanosecond latency or language interoperability that zeromq provides
as axon do not rely on any third-party compiled libraries.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/Unitech/pm2-axon là nguồn chính thức.
Unitech/pm2-axon có bao nhiêu sao?
Unitech/pm2-axon có 24 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/Unitech/pm2-axon. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
Unitech/pm2-axon có phải mã nguồn mở không?
Có — Unitech/pm2-axon phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/Unitech/pm2-axon.
Unitech/pm2-axon còn đang phát triển không?
Commit gần nhất trên Unitech/pm2-axon là 2.8 năm trước (theo timestamp GitHub). Repo có 10 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
Unitech/pm2-axon dùng license gì?
Unitech/pm2-axon phát hành theo license MIT. Nên mở file LICENSE trên GitHub để xác nhận — license metadata đôi khi lệch với thực tế dự án.
Unitech/pm2-axon là gì?
Unitech/pm2-axon (Unitech/pm2-axon) là dự án JavaScript TopGit theo dõi. Tính tới lần đồng bộ gần nhất, repo có 24 sao.
Unitech/pm2-axon viết bằng ngôn ngữ gì?
Unitech/pm2-axon chủ yếu viết bằng JavaScript. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Đọc đầy đủ README ở tab phía trên.
pm2-axon có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về pm2-axon.