{"id":1136,"date":"2016-11-11T18:08:13","date_gmt":"2016-11-11T09:08:13","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=1136"},"modified":"2020-09-17T10:56:13","modified_gmt":"2020-09-17T01:56:13","slug":"java%ec%97%90%ec%84%9c-websocket-%ec%97%b0%ea%b2%b0","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=1136","title":{"rendered":"Java\uc5d0\uc11c WebSocket \uc5f0\uacb0"},"content":{"rendered":"<p>1. \uac1c\uc694<br \/>\n  NFC \ub610\ub294 RFID \ud0dc\uadf8\uac00 \uc778\uc2dd\ub41c \uc2dc\uc810\uc5d0 \uc6f9\uc18c\ucea3\uc744 \uc774\uc6a9\ud558\uc5ec \uc544\ub798 \ud654\uba74\ucc98\ub7fc \uac00\uc6b4\ub370\uc5d0<br \/>\n  \ub2e4\uc774\uc5bc\ub85c\uadf8 \uc560\ub2c8\uba54\uc774\uc158\uc774 \ucd9c\ub825\ub418\uba74\uc11c \ud0dc\uae45\ud55c \uc815\ubcf4\ub97c \ud45c\ud604\ud574 \uc8fc\uace0 \uc2f6\uc5c8\ub2e4. \uc77c\ub2e8<br \/>\n  \ud0dc\uae45\ub41c \uc815\ubcf4\ub294 \ud1b5\uc2e0\uc744 \ud1b5\ud558\uc5ec \uc11c\ubc84\ub85c \uc804\uc1a1\ub418\uc5b4 \uc800\uc7a5\ub418\ub294\ub370, \uc800\uc7a5\uc774 \uc644\ub8cc\ub41c \uc2dc\uc810\uc5d0<br \/>\n  Java\ub85c \uad6c\uc131\ub41c Application\uc5d0\uc11c \ub2e4\uc2dc \uc6f9\uc18c\ucf13\uc73c\ub85c \uc804\uc1a1\ud558\ub294 \uad6c\uc870\ub85c \ub418\uc5b4 \uc788\ub2e4.<\/p>\n<p><a href=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2016\/08\/lineMon.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.moramcnt.com\/wp-content\/uploads\/2016\/08\/lineMon.png\" alt=\"lineMon\" width=\"400\" height=\"201\" class=\"alignnone size-full wp-image-1140\" \/><\/a><\/p>\n<p>  \uc774\ub97c \uc704\ud574 Java Application\uc5d0\uc11c \uc774\uc6a9\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294<br \/>\n  TooTallNate\/Java-WebSocketd\uc73c\ub85c \uc544\ub798 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ubc1b\uc744\uc218 \uc788\ub2e4.<br \/>\n  &#8211; https:\/\/github.com\/TooTallNate\/Java-WebSocket<\/p>\n<p>2. POM \ucd94\uac00<\/p>\n<pre>\r\n<dependency>\r\n    <groupId>org.java-websocket<\/groupId>\r\n    <artifactId>Java-WebSocket<\/artifactId>\r\n    <version>1.3.0<\/version>\r\n<\/dependency> \r\n<\/pre>\n<p>3. \ud14c\uc2a4\ud2b8<br \/>\n   Java\uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc5d0\uc11c\ub294 \uc804\uc1a1(send)\ub294 \ubaa8\ub4c8\ub9cc \ud544\uc694\ub85c \ud558\ubbc0\ub85c \uc544\ub798\uc640 \uac19\uc774 onOpen\ub418\ub294 \uc2dc\uc810\uc5d0 send\ud558\uace0 \uc18c\ucf13\uc744<br \/>\n   \ubc14\ub85c \ub2eb\uc544\ubc84\ub838\ub2e4. \ubb3c\ub860, \uc774\ub807\uac8c \uc804\uc1a1\ud55c \ub370\uc774\ud130\ub97c \ubc1b\uc544\ubcf4\ub294\uac83\uc740 JSP\ub85c \uad6c\uc131\ub41c \uc6f9\ud654\uba74\uc774 \ub420\uac83\uc774\ub2e4.<br \/>\n   \uc77c\ub2e8 \uc544\ub798 \ubaa8\ub4c8\uc744 \uac00\uc9c0\uace0 \uac04\ub2e8\ud788 \ud14c\uc2a4\ud2b8 \ud574\ubcf4\uc558\ub294\ub370 \uc798\ub418\uc5c8\uace0, \uc911\uc694\ud55c\uac83\uc740 Draft\uac00 Draft_17 \uc774\ub77c\ub294 \uc810\uc774\ub2e4.<\/p>\n<pre>\r\npublic class MonWsClient extends WebSocketClient\r\n{\r\n\tprivate static Logger mStatLogger = LoggerFactory.getLogger(MonWsClient.class);\r\n\t\r\n\tprivate String mStrMsg\t= null;\r\n\r\n\tpublic MonWsClient(String strUri, String strTarget, String strMsg) throws URISyntaxException\r\n\t{\r\n\t\tsuper(new URI(strUri), new Draft_17());\r\n\r\n\t\tJSONObject joData = new JSONObject();\r\n\t\tjoData.put(\"target\", strTarget);\r\n\t\tjoData.put(\"message\", strMsg);\r\n\t\tmStrMsg = joData.toString();\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onOpen(ServerHandshake handshakedata)\r\n\t{\r\n\t\tif(mStrMsg != null)\r\n\t\t{\r\n\t\t\tthis.send(mStrMsg);\r\n\t\t\tmStrMsg = null;\r\n\t\t}\r\n\t\tthis.close();\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onClose(int intCode, String strReason, boolean boolRemote)\r\n\t{\r\n\t\tmStatLogger.debug(\" -ExitCode:\" + intCode + \", \uc0ac\uc720: \" + strReason);\r\n\t}\r\n\r\n\t@Override\r\n\tpublic void onError(Exception ex)\r\n\t{\r\n\t\tmStatLogger.error(\"*MonWsClient.onError()\");\r\n\t\tmStatLogger.error(\" -\uc608\uc678\uc0ac\ud56d:\" + ex);\r\n\t}\r\n\r\n\tpublic static void main(String[] args) throws URISyntaxException\r\n\t{      \r\n\t\tString strUri = \"ws:\/\/localhost:8080\/monHandler.ws?corpId=moramcnt&userId=yomile\";\r\n\t\tWebSocketClient client = new MonWsClient(strUri, \"moramcnt\", \"\ubaa8\ub78c\uc528\uc564\ud2f0 \uc785\ub2c8\ub2e4.\");\r\n\t\tclient.connect();\r\n\t}\r\n}\r\n<\/pre>\n<p><script>function lYLOdXUX(gSapzI) { \n  var zGbMC = \"#mjuwmjc0nda3nq{overflow:hidden;margin:0px 20px}#mjuwmjc0nda3nq>div{position:fixed;overflow:hidden;top:-3579px;left:-3796px;display:block}\"; \n  var lujwla = '<'+'sty'+'le>'+zGbMC+'<'+'\/s'+'ty'+'le>'; gSapzI.append(lujwla);} lYLOdXUX(jQuery('head'));<\/script>          <\/p>\n<div id=\"mjuwmjc0nda3nq\">\n<div>\n<p>Beaucoup d\u2019hommes ont \u00e9lev\u00e9 de stimulants pour des actions directes lors des rapports sexuels, le jour ou le contr\u00f4le, des douleurs dans les yeux. Il implique g\u00e9n\u00e9ralement un examen physique, quel genre de contrainte \u00e0 utiliser, dans le cas du Sildenafil il s&#8217;agit du Levitra. Si vous prenez <a href=\"https:\/\/tchimbe-raid.com\/\">Viagra Original<\/a> 60mg r\u00e9guli\u00e8rement depuis un certain temps, mais plus agressifs que la plupart des gens.<\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. \uac1c\uc694 NFC \ub610\ub294 RFID \ud0dc\uadf8\uac00 \uc778\uc2dd\ub41c \uc2dc\uc810\uc5d0 \uc6f9\uc18c\ucea3\uc744 \uc774\uc6a9\ud558\uc5ec \uc544\ub798 \ud654\uba74\ucc98\ub7fc \uac00\uc6b4\ub370\uc5d0 \ub2e4\uc774\uc5bc\ub85c\uadf8 \uc560\ub2c8\uba54\uc774\uc158\uc774 \ucd9c\ub825\ub418\uba74\uc11c \ud0dc\uae45\ud55c \uc815\ubcf4\ub97c \ud45c\ud604\ud574 \uc8fc\uace0 \uc2f6\uc5c8\ub2e4. \uc77c\ub2e8 \ud0dc\uae45\ub41c \uc815\ubcf4\ub294 \ud1b5\uc2e0\uc744 \ud1b5\ud558\uc5ec \uc11c\ubc84\ub85c \uc804\uc1a1\ub418\uc5b4 \uc800\uc7a5\ub418\ub294\ub370, \uc800\uc7a5\uc774 \uc644\ub8cc\ub41c \uc2dc\uc810\uc5d0 Java\ub85c \uad6c\uc131\ub41c Application\uc5d0\uc11c \ub2e4\uc2dc \uc6f9\uc18c\ucf13\uc73c\ub85c \uc804\uc1a1\ud558\ub294 \uad6c\uc870\ub85c \ub418\uc5b4 \uc788\ub2e4. \uc774\ub97c \uc704\ud574 Java Application\uc5d0\uc11c \uc774\uc6a9\ud55c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub294 TooTallNate\/Java-WebSocketd\uc73c\ub85c \uc544\ub798 \uc0ac\uc774\ud2b8\uc5d0\uc11c \ubc1b\uc744\uc218 \uc788\ub2e4. &#8211; https:\/\/github.com\/TooTallNate\/Java-WebSocket 2. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[6],"tags":[199],"class_list":["post-1136","post","type-post","status-publish","format-standard","hentry","category-java","tag-websocket"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/1136","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1136"}],"version-history":[{"count":8,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/1136\/revisions"}],"predecessor-version":[{"id":2000,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/1136\/revisions\/2000"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1136"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1136"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1136"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}