Skip to content

not connecting #29

Description

@swarajcs

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 = '\n\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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions