Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article?
ããã£ãæããã»ã¨ãã©ãjsèªã¿è¾¼ãã é端ã«æ¥ç¶ãã¦ãããåæãããåæ¥ç¶ã¿ãããªã®ãå¤ãã (ã¨ãããããµã¤ãã«ä½¿ãåã«ã¯ããã§ãããã§ããã»ã») ä»»æã®ã¿ã¤ãã³ã°ã§æ¥ç¶ãåæããããã£ãã®ã§ä¸è¨ã®ãããªæãã§æ¥ç¶ãã¦ã¿ãã // 空ã®socketãç¨æ var socket = { on: function(){} }; // æ¥ç¶ var connect = function() { if ( !socket.connected ) { // æ¥ç¶ socket = io.connect('http://example.com:3000'); } else { // åæ¥ç¶ socket.connect(); } socket.on('msg',function(mes){ // msgåä¿¡æã®å¦ç... }); } // åæ var disconnect = function()
ãªã¢ã«ã¿ã¤ã ãªãã¼ã¿éä¿¡ã¯ã¤ã³ã¿ã©ã¯ãã£ããªwebã³ã³ãã³ãã«ã¯ä¸å¯æ¬ ã®è¦ç´ ã§ããä»åã¯ãªã¢ã«ã¿ã¤ã ãªãã¼ã¿éä¿¡ãç°¡åã«ãã¦ãããSocket.IOã使ã£ã¦ãã½ã³ã³ã¨ã¹ããããã¢ãªã³ã°ããã³ã³ãã³ããä½ãã¾ãããSocket.IOã®ç°¡åãªè§£èª¬ã¨å ±ã«ç´¹ä»ãã¾ããã¾ãã¯æ¬¡ã®ãã¢ãã覧ãã ããã â» ãã¡ã¤ã¢ã¼ã¦ã©ã¼ã«ã®è¨å®ã«ãã£ã¦ã¯é²è¦§ã§ããªãå¯è½æ§ãããã¾ãããã¢åç»ã御覧ãã ããã å¥ç»é¢ã§ãã¢ãåçãã ãµã¼ãã¼ãµã¤ãã®ã½ã¼ã¹ã³ã¼ã(Node.js) ãµã¼ãã¼ãµã¤ãã®JavaScriptãå«ãå ¨ã½ã¼ã¹ã³ã¼ã â» å ¨ã½ã¼ã¹ã³ã¼ãããã¦ã³ãã¼ããå±éå¾ã®ãã©ã«ãã¼ã«ã¦ã³ãã³ãã©ã¤ã³ã§node serverãå®è¡å¾ãhttp://localhost:5000ã«ã¢ã¯ã»ã¹ããã¨ãã¼ã«ã«ç°å¢ã§ããã¢ã確èªã§ãã¾ãã ãã¢ã«ã¤ã㦠ãã¢ãã¼ã¸ã«ã¢ã¯ã»ã¹ããã¨URLã¨ãã¢ãªã³ã°ã³ã¼ãã表示ããã¾ãã以ä¸
This domain may be for sale!
Node.jsããSocket.IOã使ãä¸ã§ç¥ã£ã¦ããã¹ãWebSocketã®èæ¯ãSocket.IOã®ç¥èã«ã¤ãã¦ã¾ã¨ãã¦ã¿ã¾ããã å¾åã¯ã¤ã³ã¹ãã¼ã«æ¹æ³ã¨ãµã³ãã«ã«ãªãã¾ãã 1. Socket.IOã¨ã¯ 1.1. HTTP ã¯ã©ã¤ã¢ã³ããããµã¼ãã¼ã«ãªã¯ã¨ã¹ããéã, ãµã¼ãã¼ã¯ããã«å¯¾ãã¦ã¬ã¹ãã³ã¹ãè¿ãã¨ãããããã³ã«ã§ãã ãµã¼ãã¼ããã¯ã©ã¤ã¢ã³ãã«å¯¾ãã¦ãªã¯ã¨ã¹ããéç¥ãéä¿¡ããæ¹æ³ã¯ç¨æããã¦ãã¾ããã 1.2. ãã¼ãªã³ã° ã¯ã©ã¤ã¢ã³ããããµã¼ãã¼ã«å®æçã«ãªã¯ã¨ã¹ããéä¿¡ããæ¹æ³ã ç¡é§ãªãªã¯ã¨ã¹ããå¢ãã¦ãã¾ãã¨ããæ¬ ç¹ãããã¾ãã 1.3. WebSocket 2011å¹´ã«RFC6455ã§ä»æ§ãææ¡ããããµã¼ãã¼ã¨ã¯ã©ã¤ã¢ã³ãã®åæ¹åéä¿¡ç¨ã®ãããã³ã«ã§, éåæãã¤åæ¹åã®éä¿¡ãå¯è½ã«ãã¦ãã¾ãã ãã©ã¦ã¶ã®ãã¼ã¸ã§ã³ã«ãã£ã¦ã¯ãµãã¼ããã¦ããªããã®ãããã®ã§
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}