事件¶
监听账本¶
Node.JS Example¶
var Remote = require('jingtum-lib').Remote;
var remote = new Remote({server: 'ws://ts5.jingtum.com:5020', local_sign:true});
remote.connect(function (err, result) {
if(err) return console.log('err: ',err);
remote.on('ledger_closed', function (msg) {
console.log('ledger: ',msg);
});
});
C# Example¶
var remote = new Remote(@"ws://ts5.jingtum.com:5020", true);
remote.Connect(result =>
{
if(result.Exception != null)
{
Console.Write(result.Exception.Message);
}
else
{
remote.LedgerClosed += (s, e) =>
{
// event handler
}
}
});
监听交易记录¶
Node.JS Example¶
var Remote = require('jingtum-lib').Remote;
var remote = new Remote({server: 'ws://ts5.jingtum.com:5020', local_sign:true});
remote.connect(function (err, result) {
if(err) return console.log('err: ', err);
remote.on('transactions', function (msg) {
console.log('transactions: ',msg);
});
});
C# Example¶
var remote = new Remote(@"ws://ts5.jingtum.com:5020", true);
remote.Connect(result =>
{
if(result.Exception != null)
{
Console.Write(result.Exception.Message);
}
else
{
remote.Transactions += (s, e) =>
{
// event handler
}
}
});