These are chat archives for waltfy/destiny

22nd
Mar 2015
kevinshaffer
@kevinshaffer
Mar 22 2015 15:58
@waltfy Hey waltfy, I could use some help getting the proxy.js to work. I'm a complete n00b when it comes to node.js, but could really use this proxy server, but I can't get it to workl!
Walter Carvalho
@waltfy
Mar 22 2015 19:03
@kevinshaffer it should be as simple as just running node proxy.js
what output do you get from that?
Baris Balic
@barisbalic
Mar 22 2015 19:11
:) @waltfy we need to get on it bud :D
Walter Carvalho
@waltfy
Mar 22 2015 19:11
@barisbalic how do you mean? :)
Baris Balic
@barisbalic
Mar 22 2015 19:21
@waltfy i mean build the playr API and remove the need for a proxy :D
Walter Carvalho
@waltfy
Mar 22 2015 20:06
yup
why don't we talk about it sometime soon?
kevinshaffer
@kevinshaffer
Mar 22 2015 20:35
@waltfy I get "Bungie Proxy Server up at http://:::9000", and then when I try to connect on the client side I get a net::ERR_CONNECTION_REFUSED error. and then looking at the actual error, it's still the same Origin is not allowed by Access-Control-Allow-Origin error :(
Walter Carvalho
@waltfy
Mar 22 2015 22:01
That's super strange.
@kevinshaffer Kevin, could you show me the code that's sending the request to your proxy server?
kevinshaffer
@kevinshaffer
Mar 22 2015 22:04
@waltfy
var client = Destiny({ host: 'http://localhost:9000' });
  client
    .search({ type: 2, name: 'shafferkevin' })
    .end(function (err, res) { console.log(err);console.log(res) });
Walter Carvalho
@waltfy
Mar 22 2015 22:04
and that logs an error to you?
Baris Balic
@barisbalic
Mar 22 2015 22:05
@waltfy yes, keen, maybe the weekend coming some breakfast and talk?
Walter Carvalho
@waltfy
Mar 22 2015 22:05
@kevinshaffer We did have some problems with that error, but that was a while ago. You definitely have the latest version correct?
kevinshaffer
@kevinshaffer
Mar 22 2015 22:05
Yes, here's the URL that i'm testing it from: http://apps.kevinashaffer.com/destiny/
You can see the error I sent above is what I'm getting
I downloaded it from your github yesterday
Walter Carvalho
@waltfy
Mar 22 2015 22:06
Is your proxy server running on the same machine?
kevinshaffer
@kevinshaffer
Mar 22 2015 22:06
Yes it is
Walter Carvalho
@waltfy
Mar 22 2015 22:06
ok
kevinshaffer
@kevinshaffer
Mar 22 2015 22:06
At least as far as I can control. It's a dreamhost server that I am running a custom node.js server on, and it's running there. Does the folder that I call node proxy.js from matter?
Walter Carvalho
@waltfy
Mar 22 2015 22:07
no the folder shouldn't matter.
Ok, if you grab access to the terminal to the server... and hit curl localhost:9000 what do you get?
in response.
kevinshaffer
@kevinshaffer
Mar 22 2015 22:08
Lots of javascript/html
Walter Carvalho
@waltfy
Mar 22 2015 22:09
I've received a response fine.
Screen Shot 2015-03-22 at 22.08.41.png
your data would be in body.Response
@barisbalic yeah that sounds good, we should totally try to at least have a high level architecture written down as a plan for a first step.
@kevinshaffer really weird, I'm not sure why you get the error :(
kevinshaffer
@kevinshaffer
Mar 22 2015 22:12
@waltfy That' super strange... Could it be something with your machine that you're accessing the web from being the one that you have your proxy running from? (I'm spitballing here)
@waltfy I say that since my box running the proxy is not the one I'm using to connect to my site.
Baris Balic
@barisbalic
Mar 22 2015 22:22
@waltfy Ive got some pretty clear thoughts. I've invited you to the org for better chatty
Walter Carvalho
@waltfy
Mar 22 2015 22:23
@barisbalic cool!
@kevinshaffer well, when I accessed your page, the code would hit your server's proxy server

so this is how it works...

Your client -> Your Proxy -> Bungie's API

Rather than Your Client -> Bungie's API due to CORS
kevinshaffer
@kevinshaffer
Mar 22 2015 22:25
@waltfy Right, that makes sense, I just don't see why we have different outcomes then :(
Walter Carvalho
@waltfy
Mar 22 2015 22:26
Do you access the same address? http://apps.kevinashaffer.com/destiny/
kevinshaffer
@kevinshaffer
Mar 22 2015 22:26
Yessir
Walter Carvalho
@waltfy
Mar 22 2015 22:26
That's super weird.
Ok, I got an error now.
kevinshaffer
@kevinshaffer
Mar 22 2015 22:28
Hmm, well I guess that's kinda promising
Walter Carvalho
@waltfy
Mar 22 2015 22:28
shouldn't you be pointing to the same domain, rather than localhost?
same domain different port.
http://localhost:9000/Platform/Destiny/SearchDestinyPlayer/2/shafferkevin/
Is the request for your account
do you see the difference? The reason using localhost works on your development environment – say – is because you're under the same domain.
so when you're in http://apps.kevinashaffer.com/destiny, you'l have to hit http://apps.kevinashaffer.com:9000 as your host for the client
does that make sense?
kevinshaffer
@kevinshaffer
Mar 22 2015 22:32
Yes, that was the problem, I was using localhost instead of that when making my initial call to your destiny method. Thank you for being so patient :) and for making something awesome
Walter Carvalho
@waltfy
Mar 22 2015 22:34
yes.
It's ok. I was really puzzled for a second as to why it work, but you were right. At first your page was pointing at my actual proxy server.
Glad it is fixed now!
kevinshaffer
@kevinshaffer
Mar 22 2015 22:35
Me too, thanks again!
Walter Carvalho
@waltfy
Mar 22 2015 22:36
Using something like a configuration file will help you: something that loads some config dynamically, so that you don't have to worry about replacing it every time. But that's something for the future I guess, have fun building whatever you are making! I'd be keen to hear more about it.
Let me know if you want anything added to it too! Cheers @kevinshaffer
Baris Balic
@barisbalic
Mar 22 2015 22:38
@waltfy we can remove the need for it altogether eventually.
Walter Carvalho
@waltfy
Mar 22 2015 22:38
@barisbalic yup, I meant for the future of Kevin's app.
Baris Balic
@barisbalic
Mar 22 2015 22:38
+1
Walter Carvalho
@waltfy
Mar 22 2015 22:40
But yes, once we have a centralised service. A client ran proxy server wouldn't be necessary at all. ;)
kevinshaffer
@kevinshaffer
Mar 22 2015 22:40
@waltfy Once it's something more than a pet project of me learning Bungie's API i'll be sure to share it :) And with this working I'll actually be able to get useful data rather than what the www.bungie-platform.herokuapp.com calls gives me
Walter Carvalho
@waltfy
Mar 22 2015 22:40
@kevinshaffer ha yeah!
Baris Balic
@barisbalic
Mar 22 2015 22:40
I tried adding you to the room, but was told you don't have permission, assuming you can join it
Walter Carvalho
@waltfy
Mar 22 2015 22:41
Awesome.
@barisbalic player.io?
Baris Balic
@barisbalic
Mar 22 2015 22:41
Indeed
Walter Carvalho
@waltfy
Mar 22 2015 22:41
Not sure if I accepted the invite yet.
Baris Balic
@barisbalic
Mar 22 2015 22:41
That would explain it
Walter Carvalho
@waltfy
Mar 22 2015 22:41
I have now.
Pretty sweet, I see you've put some time into it already! Nice.