I’m new to JavaScript. My question is simple. I need to consume RESTful api (twitter data via Twitcident) with following requirements - CORS (cross origin Request) - Authenticated (username and password) with credentials - chunked, keep-alive connection (persistant connection to fire events when ever data is available)
I have already tried xhr, Server sent Events, jsonp. Need connection to be open always.
Need any client side solutions. I’m working on asp.net MVC.
When requested directly in browser, prompts for username and password. when authenticated,got following request and response header.
Response Header
Connection:keep-alive
Content-Type:application/json
Date:Sat, 05 Sep 2015 10:33:28 GMT
Server:nginx/1.2.1
Transfer-Encoding:chunked
Request header
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Authorization:Basic somethingsomething=
Cache-Control:max-age=0
Connection:keep-alive
Host:vps6.twitcident.com
Upgrade-Insecure-Requests:1
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.85 Safari/537.36
In xhr, firebug give following error
NS_ERROR_DOM_BAD_URI: Access to restricted URI denied
Thanks in advance