Commit 6191b1c3 by zCaesar

help send wildcard

parent 01bde038
......@@ -31,6 +31,7 @@ module.exports = function (options = {}) {
getGroupID(req.body.username, req.body.client_id, (_id) => { // get groupID
// console.log(_id)
var _ftopic = require('./utils/getTopic').getTopic(topic, _id) // get topic where concat with groupID
console.log(_ftopic)
var response = {
'result': 'ok',
'modifiers': {
......
......@@ -36,6 +36,7 @@ module.exports = function (options = {}) {
getGroupID(req.body.username, req.body.client_id, (_id) => { // get groupID
// console.log(_id)
var _ftopic = require('./utils/getTopic').getTopic(topic, _id) // get topic where concat with groupID
console.log(_ftopic)
var _topic = [{ // setTopic for response
'topic': _ftopic,
'qos': 0
......
......@@ -3,7 +3,7 @@ function on_delivery(req, res, next) {
var response = {
'result': 'ok',
'modifiers': {
"topic": topics
"topic": topics
}
}
res.send(response)
......
function getTopic(topic, id) {
var _topic = classifiedTopic(topic) + '/!' + id + topic.split(classifiedTopic(topic))[1]
return _topic
console.log(topic)
if (!checkWildCard(topic)) {
var _topic = classifiedTopic(topic) + '/!' + id + topic.split(classifiedTopic(topic))[1]
return _topic
}
else return topic
}
module.exports.getTopic = getTopic
......@@ -16,4 +20,9 @@ function classifiedTopic(topic) {
} else if (topic.indexOf('@client') !== -1) {
return '@client'
}
}
function checkWildCard(topic) {
if (topic.indexOf('#') > -1) return true
else return false
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment