{"action":"created","issue":{"url":"https://api.github.com/repos/zeromq/zeromq.js/issues/248","repository_url":"https://api.github.com/repos/zeromq/zeromq.js","labels_url":"https://api.github.com/repos/zeromq/zeromq.js/issues/248/labels{/name}","comments_url":"https://api.github.com/repos/zeromq/zeromq.js/issues/248/comments","events_url":"https://api.github.com/repos/zeromq/zeromq.js/issues/248/events","html_url":"https://github.com/zeromq/zeromq.js/issues/248","id":319908602,"node_id":"MDU6SXNzdWUzMTk5MDg2MDI=","number":248,"title":"Problem with socket.subscribe()","user":{"login":"stefsz","id":38948132,"node_id":"MDQ6VXNlcjM4OTQ4MTMy","avatar_url":"https://avatars0.githubusercontent.com/u/38948132?v=4","gravatar_id":"","url":"https://api.github.com/users/stefsz","html_url":"https://github.com/stefsz","followers_url":"https://api.github.com/users/stefsz/followers","following_url":"https://api.github.com/users/stefsz/following{/other_user}","gists_url":"https://api.github.com/users/stefsz/gists{/gist_id}","starred_url":"https://api.github.com/users/stefsz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stefsz/subscriptions","organizations_url":"https://api.github.com/users/stefsz/orgs","repos_url":"https://api.github.com/users/stefsz/repos","events_url":"https://api.github.com/users/stefsz/events{/privacy}","received_events_url":"https://api.github.com/users/stefsz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-05-03T12:55:21Z","updated_at":"2018-06-06T10:08:49Z","closed_at":null,"author_association":"NONE","body":"The 0MQ spec. says that the argument to ZMQ_SUBSCRIBE in zmq_setsockopt() is to be interpreted as \"binary data\", and not as \"character string\", as your binding does.\r\n\r\nTo exemplify, the following code\r\n\r\nvar zmq = require('zeromq'),\r\n    sock = zmq.socket('sub'),\r\n    url = 'tcp://127.0.0.1:8888';\r\n\r\nvar msg_prefix = new Uint8Array('M', 'S', 'G', 0, 1, 2, 3, 4);\r\n\r\nsock.connect(url);\r\nsock.subscribe(msg_prefix);\r\nconsole.log('Subscriber connected to ' + url);\r\n\r\nhas the same effect as if the \"subscribe\" call was:\r\n\r\nsock.subscribe(\"MSG\");\r\n\r\nand that's wrong! The garbage following the '\\0' in the Uint8Array should also be passed to the zmq_setsockopt() call, and used for filtering out messages that do not contain it.\r\n\r\nIt causes me a lot of trouble having to redesign my stuff because of that..."},"comment":{"url":"https://api.github.com/repos/zeromq/zeromq.js/issues/comments/395017500","html_url":"https://github.com/zeromq/zeromq.js/issues/248#issuecomment-395017500","issue_url":"https://api.github.com/repos/zeromq/zeromq.js/issues/248","id":395017500,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NTAxNzUwMA==","user":{"login":"xelinorg","id":2007899,"node_id":"MDQ6VXNlcjIwMDc4OTk=","avatar_url":"https://avatars1.githubusercontent.com/u/2007899?v=4","gravatar_id":"","url":"https://api.github.com/users/xelinorg","html_url":"https://github.com/xelinorg","followers_url":"https://api.github.com/users/xelinorg/followers","following_url":"https://api.github.com/users/xelinorg/following{/other_user}","gists_url":"https://api.github.com/users/xelinorg/gists{/gist_id}","starred_url":"https://api.github.com/users/xelinorg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xelinorg/subscriptions","organizations_url":"https://api.github.com/users/xelinorg/orgs","repos_url":"https://api.github.com/users/xelinorg/repos","events_url":"https://api.github.com/users/xelinorg/events{/privacy}","received_events_url":"https://api.github.com/users/xelinorg/received_events","type":"User","site_admin":false},"created_at":"2018-06-06T10:08:49Z","updated_at":"2018-06-06T10:08:49Z","author_association":"NONE","body":"It looks like this one should be closed. \r\nThe library works correctly and there is not any bug I can see at the moment around issues having to do with the arguments passed to the subscribe method of the sub socket.\r\nI have added to more unit tests in socket.pub-sub to make clearer the way it expected to work.\r\n\r\n@stefsz if you console log what is the msg_prefix you are talking about, you will see that is not what you wanted to do... I believe :)\r\nThe test might help you with your accomplishment or even understanding of binary data on js world as there a couple of things messed up here.\r\n\r\nHope it helps and I am going to look a bit more the test branch of the code as there are some not major issues with tcp ports not closing when tests are done. Could be an improvement for testing.\r\n\r\nthe pr is https://github.com/zeromq/zeromq.js/pull/258"}}
{"actor":{"display_login":"xelinorg"}}