{"action":"created","issue":{"url":"https://api.github.com/repos/emitter-io/emitter/issues/140","repository_url":"https://api.github.com/repos/emitter-io/emitter","labels_url":"https://api.github.com/repos/emitter-io/emitter/issues/140/labels{/name}","comments_url":"https://api.github.com/repos/emitter-io/emitter/issues/140/comments","events_url":"https://api.github.com/repos/emitter-io/emitter/issues/140/events","html_url":"https://github.com/emitter-io/emitter/issues/140","id":330544672,"node_id":"MDU6SXNzdWUzMzA1NDQ2NzI=","number":140,"title":"any way to sub using common mqtt client?","user":{"login":"elvizlai","id":501861,"node_id":"MDQ6VXNlcjUwMTg2MQ==","avatar_url":"https://avatars3.githubusercontent.com/u/501861?v=4","gravatar_id":"","url":"https://api.github.com/users/elvizlai","html_url":"https://github.com/elvizlai","followers_url":"https://api.github.com/users/elvizlai/followers","following_url":"https://api.github.com/users/elvizlai/following{/other_user}","gists_url":"https://api.github.com/users/elvizlai/gists{/gist_id}","starred_url":"https://api.github.com/users/elvizlai/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elvizlai/subscriptions","organizations_url":"https://api.github.com/users/elvizlai/orgs","repos_url":"https://api.github.com/users/elvizlai/repos","events_url":"https://api.github.com/users/elvizlai/events{/privacy}","received_events_url":"https://api.github.com/users/elvizlai/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-08T07:12:42Z","updated_at":"2018-06-08T12:12:56Z","closed_at":null,"author_association":"NONE","body":"here is an demo writen with go, but the sub does not work.\r\n```\r\npackage main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"os\"\r\n\t\"time\"\r\n\r\n\tmqtt \"github.com/eclipse/paho.mqtt.golang\"\r\n)\r\n\r\nvar m mqtt.MessageHandler = func(client mqtt.Client, msg mqtt.Message) {\r\n\tfmt.Printf(\"rec TOPIC: %s MSG:%s\\n\", msg.Topic(), msg.Payload())\r\n}\r\n\r\nfunc main() {\r\n\t//create a ClientOptions struct setting the broker address, clientid, turn\r\n\t//off trace output and set the default message handler\r\n\topts := mqtt.NewClientOptions().AddBroker(\"tcp://api.emitter.io:8080\")\r\n\topts.SetClientID(\"go-simple\")\r\n\r\n\t//create and start a client using the above ClientOptions\r\n\tc := mqtt.NewClient(opts)\r\n\tif token := c.Connect(); token.Wait() && token.Error() != nil {\r\n\t\tpanic(token.Error())\r\n\t}\r\n\r\n\t//subscribe to the topic /go-mqtt/sample and request messages to be delivered\r\n\t//at a maximum qos of zero, wait for the receipt to confirm the subscription\r\n\tif token := c.Subscribe(\"PRIVATE_CHANNEL_KEY/test/\", 0, m); token.Wait() && token.Error() != nil {\r\n\t\tfmt.Println(token.Error())\r\n\t\tos.Exit(1)\r\n\t}\r\n\r\n\t//Publish 5 messages to /go-mqtt/sample at qos 1 and wait for the receipt\r\n\t//from the server after sending each message\r\n\tfor i := 0; ; i++ {\r\n\t\ttext := fmt.Sprintf(\"this is msg #%d!\", i)\r\n\t\ttoken := c.Publish(\"PRIVATE_CHANNEL_KEY/test/\", 0, false, text)\r\n\t\ttoken.Wait()\r\n\t\ttime.Sleep(time.Second)\r\n\t\tfmt.Println(i)\r\n\t}\r\n}\r\n```\r\n\r\nlooks like it the pub is succeed, but the sub does not work."},"comment":{"url":"https://api.github.com/repos/emitter-io/emitter/issues/comments/395742305","html_url":"https://github.com/emitter-io/emitter/issues/140#issuecomment-395742305","issue_url":"https://api.github.com/repos/emitter-io/emitter/issues/140","id":395742305,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTc0MjMwNQ==","user":{"login":"tuanpmt","id":1904924,"node_id":"MDQ6VXNlcjE5MDQ5MjQ=","avatar_url":"https://avatars3.githubusercontent.com/u/1904924?v=4","gravatar_id":"","url":"https://api.github.com/users/tuanpmt","html_url":"https://github.com/tuanpmt","followers_url":"https://api.github.com/users/tuanpmt/followers","following_url":"https://api.github.com/users/tuanpmt/following{/other_user}","gists_url":"https://api.github.com/users/tuanpmt/gists{/gist_id}","starred_url":"https://api.github.com/users/tuanpmt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tuanpmt/subscriptions","organizations_url":"https://api.github.com/users/tuanpmt/orgs","repos_url":"https://api.github.com/users/tuanpmt/repos","events_url":"https://api.github.com/users/tuanpmt/events{/privacy}","received_events_url":"https://api.github.com/users/tuanpmt/received_events","type":"User","site_admin":false},"created_at":"2018-06-08T12:12:56Z","updated_at":"2018-06-08T12:12:56Z","author_association":"NONE","body":"Please use topic name such as **topic/path/** (without root “/“) when creating channel_key, and pub/sub to **channel_key/topic/path/**\r\n\r\n"}}
{"actor":{"display_login":"tuanpmt"}}