{"action":"created","issue":{"url":"https://api.github.com/repos/socketio/socket.io/issues/2500","repository_url":"https://api.github.com/repos/socketio/socket.io","labels_url":"https://api.github.com/repos/socketio/socket.io/issues/2500/labels{/name}","comments_url":"https://api.github.com/repos/socketio/socket.io/issues/2500/comments","events_url":"https://api.github.com/repos/socketio/socket.io/issues/2500/events","html_url":"https://github.com/socketio/socket.io/issues/2500","id":143445919,"number":2500,"title":"Is there an alternate way that I can send messages to a specific client?","user":{"login":"viziionary","id":7225068,"avatar_url":"https://avatars.githubusercontent.com/u/7225068?v=3","gravatar_id":"","url":"https://api.github.com/users/viziionary","html_url":"https://github.com/viziionary","followers_url":"https://api.github.com/users/viziionary/followers","following_url":"https://api.github.com/users/viziionary/following{/other_user}","gists_url":"https://api.github.com/users/viziionary/gists{/gist_id}","starred_url":"https://api.github.com/users/viziionary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viziionary/subscriptions","organizations_url":"https://api.github.com/users/viziionary/orgs","repos_url":"https://api.github.com/users/viziionary/repos","events_url":"https://api.github.com/users/viziionary/events{/privacy}","received_events_url":"https://api.github.com/users/viziionary/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-25T07:41:41Z","updated_at":"2016-04-11T19:13:34Z","closed_at":null,"body":"Im working on a simple session based app shared by a session code in the URL. I decided to generate and assign a shorter user friendly unique ID for each client who connects to a socket, and the client who creates a session causes a socket.io room to be created with his ID. \r\n\r\nI didnt realize until later that the private messaging mechanism in socket.io relied on each client being assigned to a room named by their ID. This means that because my room for a session is named after the creator's socket ID, using `.to()` will not message that client, but rather all of the clients now assigned to that room. \r\n\r\nI could remedy this in ways that would require some re-design, but first I wanted to ask if there is an alternate way of sending a message to a specific client via his/her ID. "},"comment":{"url":"https://api.github.com/repos/socketio/socket.io/issues/comments/208507993","html_url":"https://github.com/socketio/socket.io/issues/2500#issuecomment-208507993","issue_url":"https://api.github.com/repos/socketio/socket.io/issues/2500","id":208507993,"user":{"login":"nkzawa","id":775227,"avatar_url":"https://avatars.githubusercontent.com/u/775227?v=3","gravatar_id":"","url":"https://api.github.com/users/nkzawa","html_url":"https://github.com/nkzawa","followers_url":"https://api.github.com/users/nkzawa/followers","following_url":"https://api.github.com/users/nkzawa/following{/other_user}","gists_url":"https://api.github.com/users/nkzawa/gists{/gist_id}","starred_url":"https://api.github.com/users/nkzawa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nkzawa/subscriptions","organizations_url":"https://api.github.com/users/nkzawa/orgs","repos_url":"https://api.github.com/users/nkzawa/repos","events_url":"https://api.github.com/users/nkzawa/events{/privacy}","received_events_url":"https://api.github.com/users/nkzawa/received_events","type":"User","site_admin":false},"created_at":"2016-04-11T19:13:34Z","updated_at":"2016-04-11T19:13:34Z","body":"> This means that because my room for a session is named after the creator's socket ID, using .to() will not message that client, but rather all of the clients now assigned to that room.\r\nI don't get why.\r\n\r\nUnfortunately, there is no alternate way but you can assign your own room for the private message, rather than using socket id."}}