i trying build wamp server using nodejs, wamp.io, , websocket.io. here server-side code :
var wsio = require('websocket.io'); var wamp = require('wamp.io'); var socketserver = wsio.listen(9000); var wampserver = wamp.attach(socketserver);
and trying test pub-sub via browser using autobahnjs. here client-side code :
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>wamp example</title> </head> <body> <ul class="pages"> <li> <button id="socket">call</button> </li> </ul> <script src="https://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="https://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz"> </script> <script> autobahn_debug = true; </script> <script> var connection = new autobahn.connection({ url: 'ws://localhost:9000/', realm: 'realm1' }); console.log(connection); connection.onopen = function (session) { console.log(session); // session instance of autobahn.session }; connection.onclose = function(reason, detail){ console.log(reason); } connection.open(); </script> </body> </html>
but connection got error :
websocket connection 'ws://localhost:9000/' failed: error during websocket handshake: sent non-empty 'sec-websocket-protocol' header no response received
this part of code return 'unreachable'
connection.onclose = function(reason, detail){ console.log(reason); }
is there code missed?
Comments
Post a Comment