![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
node-mate is a library for the MATE protocol, written in JavaScript for node.js.
Distributed
QoS
Easy-to-use
npm install node-mate
Starting the first mate node.
var mate = require('node-mate');
var node = mate.createNode();
node.on('listening', function() {
console.log('mate node ' + node.localNodeContact.id.toString() + ' started');
});
node.on('message', function(from, message) {
console.log('receive ' + from.id.toString() + ' message: ' + message);
});
Starting another to connect the first node and send a message.
var mate = require('node-mate');
var node = mate.createNode({
networkPort: 2016,
rootNode: {
ip: '127.0.0.1',
port: 2015
}
});
node.on('listening', function() {
console.log('mate node ' + node.localNodeContact.id.toString() + ' started');
});
node.on('root_connected', function(root) {
console.log('root node connected');
node.send(root.id.toString(), 'I\'m here!', function(success) {
if (success === true) {
console.log('send message success');
} else {
console.log('send message failed');
}
});
});
You can run these code online!
mate.createNode()
mate.Node#send()
mate.Node#end()
Create a mate node by the given options and returns the node.
options
is the mate node options, including:
networkPort
: Port of the mate node listening, default 2015
rootNode
: Address of the first connecting node when the node started, it's a object like: {ip: '127.0.0.1', port: 2015}
nodeId
: the node id, default is a random string generated by uuidnodeInfoFile
: the file that stored the node id, for reuseSend a message.
nodeId
: the node id to send to, String
message
: the message to send to, String
, Buffer
or Object
callback
: fired on sendedShut down the node.
'listening'
'root_connected'
'message'
'root_disconnect'
'net_error'
'data_error'
'net_close'
function() {}
Emitted on successful listening on the node port
function(rootNode) {}
Emitted when connected to the root node
rootNode
: Information of the root node, including id, address and so on, Object
function(fromNode, message) {}
Emitted when receive a message
fromNode
: Information of the node that send message, including id, address and so on, Object
message
: message of recevied, String
, Buffer
or Object
function(rootNode) {}
Emitted after lost the connection with the root node
rootNode
: Information of the root node, including id, address and so on, Object
function(error) {}
Emitted when the node cannot listening.
function(error) {}
Emitted when a parsing error occurs.
Emitted when the node shut down.
By contributing code to the project in any form, including sending a pull request via Github, a code fragment or patch via email.
MIT
FAQs
The library for the MATE protocol
We found that node-mate demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.