Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
mqlight-dev
Advanced tools
MQ Light is designed to allow applications to exchange discrete pieces of information in the form of messages. This might sound a lot like TCP/IP networking, and MQ Light does use TCP/IP under the covers, but MQ Light takes away much of the complexity and provides a higher level set of abstractions to build your applications with.
This Node.js module provides the high-level API by which you can interact with the MQ Light runtime.
Current Features:
More functionality coming soon.
Install it in node.js:
npm install https://ibm.biz/node-mqlight
var mqlight = require('mqlight');
Then create some clients to send and receive messages:
var client = mqlight.createClient({
clientId: 'client-id1'
});
var topic = "public";
client.on('connected', function() {
client.send(topic, "Hello World!");
});
client.connect();
var client = mqlight.createClient({
clientId: 'client-id2'
});
var address = "public";
client.on('connected', function() {
client.subscribe(address);
client.on('message', function(data, delivery) {
console.log(data);
});
});
client.connect();
options
])Creates an MQ Light client instance.
options
, (Object) options for the client. Properties include:
Returns Client
object representing the client instance.
callback
])Connects the MQ Light client instance to the service.
callback
- (Function) (optional) callback to be notified of errors &
completiontopic
, message
[, options
[, callback
]])Sends the given MQ Light message object to its address. String and Buffer messages will be sent and received as-is. Any other Object will be converted to JSON before sending and automatically parsed back into the same Object type when received.
topic
- (String) the topic to which the message will be sent.message
- (String | Buffer | Object) the message body to be sentoptions
- (Object) (optional) map of additional options for the send.callback
- (Function) (optional) callback to be notified of errors &
completionpattern
[, share
[,options
[, callback
]]])Create a subscription
and associates it with a pattern
.
The pattern
is matched against the address
attribute of messages sent to
the IBM MQ Light messaging service to determine whether a particular message
will be delivered to a particular Destination
.
pattern
- (String) used to match against the address
attribute of
messages to determine if a copy of the message should be received.share
- (String) (optional) name for creating or joining a shared
subscription for which messages are anycast between connected subscribers. If
omitted defaults to unshared (e.g. private).options
- (Object) (optional) map of additional options for the destination.callback
- (Function) callback to be notified of errors & completion.Returns the Client
object that the subscribe was called on which will emit
message
events on arrival.
Returns the identifier associated with the client. This will either be what
was passed in on the Client.createClient
call or an autogenerated id.
Returns the URL of the service to which the client is currently connected to, or undefined if not connected.
Returns the current state of the client, which will be one of: 'connected', 'connecting', 'disconnected' or 'disconnecting'.
Disconnects this Client from the messaging server and frees the system
resources that it uses. Calling this method also implicitly closes any
subscriptions that have been created using the client's
Client.subscribe
method.
To run the samples, install the module via npm and navigate to the
mqlight/samples/
folder.
Usage:
Receiver Example:
Usage: recv.js [options] <address>
address: amqp://<domain>/<name>
(default amqp://localhost/public)
Options:
-h, --help show this help message and exit
Sender Example:
Usage: send.js [options] <msg_1> ... <msg_n>
Options:
-h, --help show this help message and exit
-a ADDRESS, --address=ADDRESS
address: amqp://<domain>/<name>
(default amqp://localhost/public)
-d NUM, --delay=NUM add a NUM seconds time delay between each request
FAQs
IBM MQ Light Client Module
We found that mqlight-dev demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.