{"action":"created","issue":{"url":"https://api.github.com/repos/fpanettieri/unity-socket.io/issues/12","labels_url":"https://api.github.com/repos/fpanettieri/unity-socket.io/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/fpanettieri/unity-socket.io/issues/12/comments","events_url":"https://api.github.com/repos/fpanettieri/unity-socket.io/issues/12/events","html_url":"https://github.com/fpanettieri/unity-socket.io/pull/12","id":64887037,"number":12,"title":"changed Parse class to be an interface and added getter/setter for it in...","user":{"login":"reydanro","id":2466731,"avatar_url":"https://avatars.githubusercontent.com/u/2466731?v=3","gravatar_id":"","url":"https://api.github.com/users/reydanro","html_url":"https://github.com/reydanro","followers_url":"https://api.github.com/users/reydanro/followers","following_url":"https://api.github.com/users/reydanro/following{/other_user}","gists_url":"https://api.github.com/users/reydanro/gists{/gist_id}","starred_url":"https://api.github.com/users/reydanro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reydanro/subscriptions","organizations_url":"https://api.github.com/users/reydanro/orgs","repos_url":"https://api.github.com/users/reydanro/repos","events_url":"https://api.github.com/users/reydanro/events{/privacy}","received_events_url":"https://api.github.com/users/reydanro/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-28T02:05:44Z","updated_at":"2015-04-22T01:28:40Z","closed_at":"2015-04-22T01:28:40Z","pull_request":{"url":"https://api.github.com/repos/fpanettieri/unity-socket.io/pulls/12","html_url":"https://github.com/fpanettieri/unity-socket.io/pull/12","diff_url":"https://github.com/fpanettieri/unity-socket.io/pull/12.diff","patch_url":"https://github.com/fpanettieri/unity-socket.io/pull/12.patch"},"body":"I wish to support messages that have a string payload, but the current Parser class throws an exception if it is not of type OBJECT.\r\n\r\nIs there a real reason for this exception?\r\n\r\nI would propose transforming the `Parser` class into an interface. I created  a `DefaultParser` class that is used in `SocketIOComponent.Awake()`, and also added a getter/setter for the parser so that the user can override it with a custom class if his own.\r\n\r\nHow do you find these changes?\r\n\r\nThanks"},"comment":{"url":"https://api.github.com/repos/fpanettieri/unity-socket.io/issues/comments/94993296","html_url":"https://github.com/fpanettieri/unity-socket.io/pull/12#issuecomment-94993296","issue_url":"https://api.github.com/repos/fpanettieri/unity-socket.io/issues/12","id":94993296,"user":{"login":"fpanettieri","id":301392,"avatar_url":"https://avatars.githubusercontent.com/u/301392?v=3","gravatar_id":"","url":"https://api.github.com/users/fpanettieri","html_url":"https://github.com/fpanettieri","followers_url":"https://api.github.com/users/fpanettieri/followers","following_url":"https://api.github.com/users/fpanettieri/following{/other_user}","gists_url":"https://api.github.com/users/fpanettieri/gists{/gist_id}","starred_url":"https://api.github.com/users/fpanettieri/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpanettieri/subscriptions","organizations_url":"https://api.github.com/users/fpanettieri/orgs","repos_url":"https://api.github.com/users/fpanettieri/repos","events_url":"https://api.github.com/users/fpanettieri/events{/privacy}","received_events_url":"https://api.github.com/users/fpanettieri/received_events","type":"User","site_admin":false},"created_at":"2015-04-22T01:28:40Z","updated_at":"2015-04-22T01:28:40Z","body":"I don't like these changes, let me explain why:\r\n\r\n1. They don't provide a feature, nor solve the problem you present.\r\nIf anybody downloads the library with these changes merged, there will be no difference with the existing code base. In order to use this solution, new users need to know that there is an extension point here, that solves this particular use case.\r\n\r\n2. It's not documented on the standard socket.io parser library documentation. Maybe I missed it and you can point it out, but the original implementation attemped to be almos 1:1 with the javascript library to smooth the transition. Merging this sounds as it might add an obscure solution that might actually create unexpected bugs.\r\n\r\n3. Creating an interface, implementing it, injecting it on creation sounds like a good Java solution. That's how you would normally implement something with Spring. It's not a good solution in this case. As I mentioned above, it only adds a layer of complexity but doesn't add new fuctionality.\r\n\r\nIf you need to to send a plain string, the best solution is to wrap it client side in a simple object. In order to do that you only need a simple function that takes the string, and returns it wrapped in an object. Then use that function in the class that you are using to handle your connection.\r\n\r\nIf you call this object from multiple classes, then you might want to create a helper class with a static function that wrap strings in object.\r\n\r\nThanks a lot for the contribution, please take in mind that the parser is implemented to match the socket.io 1.X specification."}}