contract EventSubscriber { function onCreate() { Global.message = ''; Global.events = []; } export function init(topic) { print(topic); YancloudUtil.subscribe(topic, handler); return 'done'; } function handler(e) { var ret = 'receive event, topic: ' + e.topic + ' semantics: ' + e.semantics + ' content:\n' + JSON.stringify(e.content); Global.message = ret; Global.events.push(e.getAll()); } export function getMsg() { return Global.message; } export function getEves() { return JSON.stringify(Global.events); } }