node.js - websocket.io is raising on method of undefined error -


कोड

  var एक्सप्रेस = require ('express'), wsio = require (' websocket.io '); / ** * एक्सप्रेस एप्लिकेशन बनाएं * / Var ऐप = express.createServer (); / ** * सुनो * / ऐप.लिटेन (3000); / ** * websocket सर्वर संलग्न करें * / Var ws = wsio.attach (एप); / ** * अपने कोड की सेवा * / app.use (express.static ('public')); / ** * कनेक्शन पर सुनना * / ws.on ('कनेक्शन', फ़ंक्शन (सॉकेट) {// संदेश ईवेंट पर सुनें और इसे वापस / socket.on ('message', function (msg) {// Console.log ('\ 033 [96mgot: \ 033 [3 9' + msg); // सॉकेट.send ('pong'); //});});  

मुझे यह त्रुटि मिल रही है

  .io \ lib \ प्रोटोकॉल \ hybi-16.js: 39 .on ('text', फ़ंक्शन (पैकेट) ) {^ प्रकार: त्रुटि: ऑब्जेक्ट # और लेफ्टिनेंट; रिसीवर & gt; नए वेबसॉट पर कोई तरीका नहीं है (एच: \ wamp \ www \ प्रथाओं \ nodejs \ smashing \ chapter10-websocket \ node_modules \ websocket.io \ lib \ protocols \ hybi- 16.js: 39: 6) सर्वर पर .createClient (एच: \ wamp \ www \ प्रथाओं \ nodejs \ smashing \ chapter10-webs ocket \ node_modules \ websocket.io \ lib \ server.js: 88: 10) सर्वर पर। संभाल अपग्रेड (एच: \ wamp \ www \ प्रथाओं \ nodejs \ smashing \ chapter10-वेब सॉकेट \ node_modules \ websocket.io \ lib \ server.js: 60: 21) HTTPServer पर। & Lt; अनाम & gt; (एच: \ wamp \ www Socket.socket पर HTTPServer.EventEmitter.emit पर (events.js: 106: 17) \ प्रथाओं \ nodejs \ smashing \ chapter10-w ebsocket \ node_modules \ websocket.io \ lib \ websocket.io.js: 92: 8) टीसीपी.नॉरेड (नेट। जेएस: 525: 27) पर ऑनडाटा (http.js: 1986: 14)  

आप एक्सप्रेस के एक पुराने संस्करण का उपयोग कर सकते हैं। createServer बहिष्कृत है और एक्सप्रेस> = 3.x एक HTTP सर्वर नहीं लौटाता है तो हो सकता है कि कोई भी एचटीटीपी सर्वर जुड़ा हो, जो आपको उस त्रुटि को फेंकता है।

एक्सप्रेस को http सर्वर से जुड़ा होना जरूरी है तो हाल के मानकों के लिए लाइब्रेरी और कोड अपडेट करें।

देखें

Comments

Popular posts from this blog

asp.net - Procedure or function "Procedure name" expects a parameter "Param name" which was not supplied occurs rarely -

c++ - Redefined variable in the other module -

c# - The item with identity 'Id' already exists in the metadata collection. Parameter name: item -