-
-
Save tmpvar/639934 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'), | |
http = require('http'), | |
cookie = require('cookie'), | |
count = 0; | |
initConnect = function(clientID) { | |
connectSite = http.createClient(80, 'ws30.sync.skoreit.com'); | |
connectRequest = connectSite.request('POST', '/request.ashx?key=11111111-1111-1111-1111-111111111111&token=' + new Date().getTime(), { | |
'host': 'ws30.sync.skoreit.com', | |
'Content-type': 'text/json; charset=utf-8', | |
'Connection': 'keep-alive', | |
'referring-domain': 'https://www.skoreit.com' | |
}); | |
connectJSON = [{ | |
"channel": "/meta/connect", | |
"connectionType": "long-polling", | |
"id": count++, | |
"clientId": clientID | |
}]; | |
console.log(connectJSON); | |
connectRequest.end(JSON.stringify(connectJSON)); | |
console.log('At this point, the server seems to be waiting for me to send some more information in another request, specifying the auction channel(s)?'); | |
console.log('You can check out skoreit.com with firebug to see the requests -- when it sends this request here, the response is that of auction details, but I don\'t see where to send the auction request?'); | |
// Maybe this is what it's doing, but I can't figure out how to make this not end up in a 'document moved' -- the request sent from the browser seems fine (according to firebug)... | |
// auctionSite = http.createClient(80, 'www.skoreit.com'); | |
// auctionRequest = auctionSite.request('GET', '/Auctions/CurrentAuctionData?auctionIds=6209&auctionIds=6207&auctionIds=6206&auctionIds=6205&auctionIds=6201&auctionIds=6197&auctionIds=6202&auctionIds=6204&auctionIds=6199', { | |
// 'host': 'www.skoreit.com', | |
// 'Content-Type': 'application/json; charset=utf-8', | |
// 'Accept': 'application/json, text/javascript, */*' | |
// }); | |
// auctionRequest.end(); | |
// auctionRequest.on('response', function (response) { | |
// console.log('STATUS: ' + response.statusCode); | |
// console.log('HEADERS: ' + JSON.stringify(response.headers)); | |
// response.setEncoding('utf8'); | |
// data = ''; | |
// response.on('data', function (chunk) { | |
// data += chunk; | |
// console.log('BODY: ' + chunk); | |
// }); | |
// response.on('end', function () { | |
// connect = JSON.parse(data); | |
// console.log(connect); | |
// }) | |
// }); | |
connectRequest.on('response', function (response) { | |
console.log('STATUS: ' + response.statusCode); | |
console.log('HEADERS: ' + JSON.stringify(response.headers)); | |
response.setEncoding('utf8'); | |
data = ''; | |
response.on('data', function (chunk) { | |
data += chunk; | |
console.log('BODY: ' + chunk); | |
}); | |
response.on('end', function () { | |
connect = JSON.parse(data); | |
console.log(connect); | |
}) | |
}); | |
} | |
// initConnect('230238'); | |
handshakeSite = http.createClient(80, 'ws30.sync.skoreit.com'); | |
handshakeRequest = handshakeSite.request('POST', '/request.ashx?key=11111111-1111-1111-1111-111111111111&token=' + new Date().getTime(), { | |
'host': 'ws30.sync.skoreit.com', | |
'Content-type': 'text/json; charset=utf-8' | |
}); | |
handshakeJSON = [{ | |
"channel": "/meta/handshake", | |
"id": count++, | |
"supportedConnectionTypes": ["long-polling", "callback-polling"], | |
"version": "1.0" | |
}]; | |
handshakeRequest.end(JSON.stringify(handshakeJSON)); | |
handshakeRequest.on('response', function (response) { | |
console.log('STATUS: ' + response.statusCode); | |
console.log('HEADERS: ' + JSON.stringify(response.headers)); | |
response.setEncoding('utf8'); | |
data = ''; | |
response.on('data', function (chunk) { | |
data += chunk; | |
console.log('BODY: ' + chunk); | |
}); | |
response.on('end', function () { | |
handshake = JSON.parse(data); | |
console.log(handshake[0].clientId); | |
initConnect(handshake[0].clientId); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment