{"action":"created","issue":{"url":"https://api.github.com/repos/Jycraft/jycraft/issues/19","labels_url":"https://api.github.com/repos/Jycraft/jycraft/issues/19/labels{/name}","comments_url":"https://api.github.com/repos/Jycraft/jycraft/issues/19/comments","events_url":"https://api.github.com/repos/Jycraft/jycraft/issues/19/events","html_url":"https://github.com/Jycraft/jycraft/issues/19","id":120540450,"number":19,"title":"JSON Semantics","user":{"login":"AngelMunoz","id":8684875,"avatar_url":"https://avatars.githubusercontent.com/u/8684875?v=3","gravatar_id":"","url":"https://api.github.com/users/AngelMunoz","html_url":"https://github.com/AngelMunoz","followers_url":"https://api.github.com/users/AngelMunoz/followers","following_url":"https://api.github.com/users/AngelMunoz/following{/other_user}","gists_url":"https://api.github.com/users/AngelMunoz/gists{/gist_id}","starred_url":"https://api.github.com/users/AngelMunoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngelMunoz/subscriptions","organizations_url":"https://api.github.com/users/AngelMunoz/orgs","repos_url":"https://api.github.com/users/AngelMunoz/repos","events_url":"https://api.github.com/users/AngelMunoz/events{/privacy}","received_events_url":"https://api.github.com/users/AngelMunoz/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Jycraft/jycraft/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"AngelMunoz","id":8684875,"avatar_url":"https://avatars.githubusercontent.com/u/8684875?v=3","gravatar_id":"","url":"https://api.github.com/users/AngelMunoz","html_url":"https://github.com/AngelMunoz","followers_url":"https://api.github.com/users/AngelMunoz/followers","following_url":"https://api.github.com/users/AngelMunoz/following{/other_user}","gists_url":"https://api.github.com/users/AngelMunoz/gists{/gist_id}","starred_url":"https://api.github.com/users/AngelMunoz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AngelMunoz/subscriptions","organizations_url":"https://api.github.com/users/AngelMunoz/orgs","repos_url":"https://api.github.com/users/AngelMunoz/repos","events_url":"https://api.github.com/users/AngelMunoz/events{/privacy}","received_events_url":"https://api.github.com/users/AngelMunoz/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Jycraft/jycraft/milestones/2","html_url":"https://github.com/Jycraft/jycraft/milestones/2","labels_url":"https://api.github.com/repos/Jycraft/jycraft/milestones/2/labels","id":1431167,"number":2,"title":"2","description":"Clean up some code/build friction.","creator":{"login":"pauleveritt","id":455142,"avatar_url":"https://avatars.githubusercontent.com/u/455142?v=3","gravatar_id":"","url":"https://api.github.com/users/pauleveritt","html_url":"https://github.com/pauleveritt","followers_url":"https://api.github.com/users/pauleveritt/followers","following_url":"https://api.github.com/users/pauleveritt/following{/other_user}","gists_url":"https://api.github.com/users/pauleveritt/gists{/gist_id}","starred_url":"https://api.github.com/users/pauleveritt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauleveritt/subscriptions","organizations_url":"https://api.github.com/users/pauleveritt/orgs","repos_url":"https://api.github.com/users/pauleveritt/repos","events_url":"https://api.github.com/users/pauleveritt/events{/privacy}","received_events_url":"https://api.github.com/users/pauleveritt/received_events","type":"User","site_admin":false},"open_issues":4,"closed_issues":0,"state":"open","created_at":"2015-11-26T13:39:52Z","updated_at":"2015-12-10T19:54:20Z","due_on":null,"closed_at":null},"comments":10,"created_at":"2015-12-05T08:31:12Z","updated_at":"2015-12-12T15:20:00Z","closed_at":null,"body":"Hello! I've been wondering if @pauleveritt  has thought about the semantics for what should look like for the messages coming in and from the websocket. Ben suggested working with gson and I like his idea, but right now I would like to have an idea what kind of JSON structure will we be dealing with so I can start working towards it.\r\n\r\nAs far as I can think now, I would have to make a few classes in java representing the JSON message this could be some examples (but not definitive ones):\r\n  \r\n- Message.\r\n    - BroadcastMessage (somewhat something that sould be informed to all players).\r\n    - CommandMessage (messages that have python lines to be executed).\r\n    - TelnetMessage (something that the telnet port will receive in order to execute or something more complex)\r\n\r\nMessage being the father of the other classes these are just a few thoughts, of course I could be wrong, I would like to have some feedback on this.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Jycraft/jycraft/issues/comments/164160775","html_url":"https://github.com/Jycraft/jycraft/issues/19#issuecomment-164160775","issue_url":"https://api.github.com/repos/Jycraft/jycraft/issues/19","id":164160775,"user":{"login":"pauleveritt","id":455142,"avatar_url":"https://avatars.githubusercontent.com/u/455142?v=3","gravatar_id":"","url":"https://api.github.com/users/pauleveritt","html_url":"https://github.com/pauleveritt","followers_url":"https://api.github.com/users/pauleveritt/followers","following_url":"https://api.github.com/users/pauleveritt/following{/other_user}","gists_url":"https://api.github.com/users/pauleveritt/gists{/gist_id}","starred_url":"https://api.github.com/users/pauleveritt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pauleveritt/subscriptions","organizations_url":"https://api.github.com/users/pauleveritt/orgs","repos_url":"https://api.github.com/users/pauleveritt/repos","events_url":"https://api.github.com/users/pauleveritt/events{/privacy}","received_events_url":"https://api.github.com/users/pauleveritt/received_events","type":"User","site_admin":false},"created_at":"2015-12-12T15:19:59Z","updated_at":"2015-12-12T15:19:59Z","body":"Is it correct that the wssOpen does not accept JSON input? It looks like, when doing the initial connection, I still send a string with login!password:\n\n@Override\npublic void wssOpen(WebSocket webSocket, ClientHandshake chs) {\n    plugin.log(\"New websocket connection\");\n    PyInterpreter interpreter = new PyInterpreter();\n    OutputStream os = new SFLOutputStream(webSocket);\n    interpreter.setOut(os);\n    interpreter.setErr(os);\n    connections.put(webSocket,interpreter);\n    buffers.put(webSocket, \"\");\n    authorized.put(webSocket, password == null || \"\".equals(password));\n    webSocket.send(\"Login by sending 'login!<PASSWORD>'\\n\");\n}\n\nAt some point we should consider changing that to JSON as well. We are likely in the future to have both a username and a password.\n\n—Paul\n\n> On Dec 10, 2015, at 11:38 AM, Angel Daniel Munoz Gonzalez <notifications@github.com> wrote:\n> \n> Hello @pauleveritt <https://github.com/pauleveritt> \n> seems we've got it:\n>  <https://cloud.githubusercontent.com/assets/8684875/11721019/0664483e-9f1f-11e5-9341-9bae895c0556.png>\n> The websocket acts basically like the command line with the old behavior just except this time we're jsonify'ing everything following the next structure:\n> \n> // client sends a command to execute in the server\n> '{ \"type\": \"execute\", \"command\": \"print 'hello world!'\" }'\n> // server returns the response:\n> {\"type\":\"execute\",\"result\":\"hello world!\\n\",\"status\":{\"code\":105,\"message\":\"Sending Result\"}}\n> // the status message can be changed for something like Executed succesfully or just not including it.\n> // if we send something like a for i in range(0,5):\n> {\"type\":\"execute\",\"result\":\"... \",\"status\":{\"code\":101,\"message\":\"More input expected\"}}\n> {\"type\":\"execute\",\"result\":\"0\\n\",\"status\":{\"code\":105,\"message\":\"Sending Result\"}}\n> {\"type\":\"execute\",\"result\":\"1\\n\",\"status\":{\"code\":105,\"message\":\"Sending Result\"}}\n> {\"type\":\"execute\",\"result\":\"2\\n\",\"status\":{\"code\":105,\"message\":\"Sending Result\"}}\n> {\"type\":\"execute\",\"result\":\"3\\n\",\"status\":{\"code\":105,\"message\":\"Sending Result\"}}\n> {\"type\":\"execute\",\"result\":\"4\\n\",\"status\":{\"code\":105,\"message\":\"Sending Result\"}}\n> // next line should be read like \"result\": \">>>\"\n> {\"type\":\"execute\",\"result\":\"\\u003e\\u003e\\u003e \",\"status\":{\"code\":102,\"message\":\"Expecting input\"}}\n> By the moment I'm looking at the exception output, due the fact the interpreter uses the same output stream object and it doesn't differentiate exception outputs and normal outputs, something I think could work could be to use a different output stream for errors which sends the error output to the same websocket.\n> I will commit these on socket-dev branch and await for review\n> \n> —\n> Reply to this email directly or view it on GitHub <https://github.com/Jycraft/jycraft/issues/19#issuecomment-163681061>.\n> \n\n"}}