{"action":"created","issue":{"url":"https://api.github.com/repos/phpredis/phpredis/issues/208","repository_url":"https://api.github.com/repos/phpredis/phpredis","labels_url":"https://api.github.com/repos/phpredis/phpredis/issues/208/labels{/name}","comments_url":"https://api.github.com/repos/phpredis/phpredis/issues/208/comments","events_url":"https://api.github.com/repos/phpredis/phpredis/issues/208/events","html_url":"https://github.com/phpredis/phpredis/issues/208","id":5361648,"number":208,"title":"subscribe/unsubscribe/publish","user":{"login":"wpbloger","id":1907348,"avatar_url":"https://avatars.githubusercontent.com/u/1907348?v=3","gravatar_id":"","url":"https://api.github.com/users/wpbloger","html_url":"https://github.com/wpbloger","followers_url":"https://api.github.com/users/wpbloger/followers","following_url":"https://api.github.com/users/wpbloger/following{/other_user}","gists_url":"https://api.github.com/users/wpbloger/gists{/gist_id}","starred_url":"https://api.github.com/users/wpbloger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wpbloger/subscriptions","organizations_url":"https://api.github.com/users/wpbloger/orgs","repos_url":"https://api.github.com/users/wpbloger/repos","events_url":"https://api.github.com/users/wpbloger/events{/privacy}","received_events_url":"https://api.github.com/users/wpbloger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2012-06-29T20:51:17Z","updated_at":"2016-10-27T07:47:14Z","closed_at":null,"body":"Hello,\n I have does not work function subscribe (subscription channels), when I run the code from the example on eg. github, the server for a long time boot and then returns a 504 error, it seems to the eternal cycle. \nTell me what am I doing wrong?\n And another question, how do I unsubscribe from a channel? \nVersion Redis: 3.4\nphpredis just reinstalled. \nThe code which I'm testing:\n$redis = new Redis();\n$redis->connect('127.0.0.1',6379);\nfunction f($redis, $chan, $msg) {\n    switch($chan) {\n        case 'chan-1':\n            //...\n            break;\n\n```\n    case 'chan-2':\n        //...\n        break;\n\n    case 'chan-2':\n        //...\n        break;\n}\n```\n\n}\n$redis->subscribe(array('chan-1', 'chan-2', 'chan-3'), 'f'); // subscribe to 3 chans\n"},"comment":{"url":"https://api.github.com/repos/phpredis/phpredis/issues/comments/256571054","html_url":"https://github.com/phpredis/phpredis/issues/208#issuecomment-256571054","issue_url":"https://api.github.com/repos/phpredis/phpredis/issues/208","id":256571054,"user":{"login":"malaysarkar","id":3381048,"avatar_url":"https://avatars.githubusercontent.com/u/3381048?v=3","gravatar_id":"","url":"https://api.github.com/users/malaysarkar","html_url":"https://github.com/malaysarkar","followers_url":"https://api.github.com/users/malaysarkar/followers","following_url":"https://api.github.com/users/malaysarkar/following{/other_user}","gists_url":"https://api.github.com/users/malaysarkar/gists{/gist_id}","starred_url":"https://api.github.com/users/malaysarkar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/malaysarkar/subscriptions","organizations_url":"https://api.github.com/users/malaysarkar/orgs","repos_url":"https://api.github.com/users/malaysarkar/repos","events_url":"https://api.github.com/users/malaysarkar/events{/privacy}","received_events_url":"https://api.github.com/users/malaysarkar/received_events","type":"User","site_admin":false},"created_at":"2016-10-27T07:47:14Z","updated_at":"2016-10-27T07:47:14Z","body":"The best way I found so far to unblock the \"subscribe function call\" is to close the redis connection by calling $redis->close(); But you won't be able to return a value though.\r\n\r\nAdditional info: I also noticed; using $redis->subscribe($ch, $foo); multiple time from withing the callback keeps blocking the thread. Thus keeps increasing the call-stack. Better to use $redis->rawCommand(\"subscribe\",$c); if you want additional channels to be included later."}}
{"actor":{"display_login":"malaysarkar"}}