websocket proxy,what if the sever reject the connect with status other than 101
Created by: kd128
it happen when sever dothing like
var http = require('http');
var server = http.createServer(function (req, res) {
......//do normal request
}).listen(1337);
var accept = function(request){
if(ok){
return true;
} else {
return false;
}
}
server.on('upgrade',function (request, socket, head) {
if(!accept(request)){//here the http-proxy will not work!
socket.write("HTTP/1.1 406 Not Acceptable\r\n");
socket.write("Connection: close\r\n");
socket.write("\r\n");
socket.end();
return;
}
......//do websocket request
});