theturtle32 / AS3WebSocket

ActionScript 3 WebSocket client implementation for the final WebSocket Draft RFC6455
Apache License 2.0
247 stars 97 forks source link

not connecting #29

Open swarajcs opened 8 years ago

swarajcs commented 8 years ago

Its not connecting ...

Am connecting to a websocket

var net = require('net'); var http = require('http');

http.globalAgent.maxSockets = 1000; var server_port = 4000;

function policy() { var xml = '<?xml version="1.0"?>\n<!DOCTYPE cross-domain-policy SYSTEM' + '"http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">\n\n'; xml += '\n'; xml += '\n\0' ; return xml; }

console.log("server started");

//var WebSocketServer = require('/root/node_modules/ws').Server
var WebSocketServer = require('ws').Server , wss = new WebSocketServer({ port: server_port });

wss.on('connection', function connection(ws) {

       console.log("connection established");

       ws.on('message', function incoming(message) 
       {

            console.log(message);

            if(message == '<policy-file-request/>\0')
            {
                var x = policy();
                ws.send(x);
                return;
            }

        });

        ws.on('close', function() {

        });

        ws.on('error', function() {

        });

});

what could be the issue?

mesaglam commented 1 year ago

Hi, did you test with https://www.piesocket.com/websocket-tester

I did, and it works very well....