【修改】基础功能验证
This commit is contained in:
@@ -8,7 +8,7 @@ end
|
||||
|
||||
function on_message(sess, topic_id, msg, sess_context, env)
|
||||
-- print("message call on message function, id", topic_id)
|
||||
-- print("message is", msg.data)
|
||||
print("message is", msg.data)
|
||||
end
|
||||
|
||||
function plugin_load(stellar, plug_env)
|
||||
@@ -16,12 +16,12 @@ function plugin_load(stellar, plug_env)
|
||||
print("this example aims to test topic functions")
|
||||
|
||||
plug_env.st = stellar
|
||||
plug_env.id = plugin_manage.register(stellar, plugin_ctx_new, plugin_ctx_free, plug_env)
|
||||
plug_env.id = session_plugin.register(stellar, plugin_ctx_new, plugin_ctx_free, plug_env)
|
||||
plug_env.data = "this is message example plug env data"
|
||||
|
||||
--[[ 订阅TOPIC_SESSION_STAT, 并完成函数注册 ]]
|
||||
test_topic_id = message.gettopicid(stellar, "TOPIC_SESSION_STAT")
|
||||
message.subscribetopic(stellar, test_topic_id, on_message, plug_env.id)
|
||||
test_topic_id = session_mq.get_topic_id(stellar, "TOPIC_SESSION_STAT")
|
||||
session_mq.subscribe_topic(stellar, test_topic_id, on_message, plug_env.id)
|
||||
end
|
||||
|
||||
function plugin_unload(plug_env)
|
||||
|
||||
Reference in New Issue
Block a user