3Dlove Posted January 20, 2016 Share Posted January 20, 2016 Hello guys ans happy new year =D In order to solve cross-origin blocks, I created a PHP script which transfer images from other subdomains but the problem is that navigators implements a Simultaneous TCP connexions Limit (6 for Chrom and Firefox). To implement CORS I added these lines in my PHP script : header('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Credentials: true'); Exists another way to bypass cross-origin blocks ? (download the image in the DOM and use it for WebGL ?) Thanks Quote Link to comment Share on other sites More sharing options...
jerome Posted January 20, 2016 Share Posted January 20, 2016 There is no way to bypass the CORS limitations in a browser because they are a part a the internal security. You could use a public CORS enables proxy like this one : https://crossorigin.me/ I don't get the relation between the simultaneous tcp connections and the CORS limitation. Quote Link to comment Share on other sites More sharing options...
chg Posted January 20, 2016 Share Posted January 20, 2016 The limits to HTTP connections per server have nothing to do with CORS, and 6 is higher than it ever used to be ( See http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser ) EDIT: also why would you need more than 6 connections for downloading images, I doubt the extra connections would improve the overall speed of downloading assets significantly Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 20, 2016 Share Posted January 20, 2016 I use .htaccess for CORS : Header set Access-Control-Allow-Origin "*" Header set Access-Control-Allow-Headers "Cache-Control, Pragma, Origin, Authorization, Content-Type, X-Requested-With" Header set Access-Control-Allow-Methods "PUT, GET, POST, OPTIONS" 3Dlove 1 Quote Link to comment Share on other sites More sharing options...
3Dlove Posted January 20, 2016 Author Share Posted January 20, 2016 OK for CORS implementation ;-) But, I need to load instantly between 50 and 240 different images, but these images are dynamic and they depend of keywords like an online shop so I can't use sprite sheet :-( Because that I would like to request more than 6 simultaneous connexions to my proxy PHP script. Quote Link to comment Share on other sites More sharing options...
Dad72 Posted January 20, 2016 Share Posted January 20, 2016 Maybe this link can help you: http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser Quote Link to comment Share on other sites More sharing options...
jerome Posted January 20, 2016 Share Posted January 20, 2016 you won't be able to predict every browser max connection number limits ... and it's not a respectful practice (from the web hoster point of view) to monopolize at the same time a big number of simultaneous connection Quote Link to comment Share on other sites More sharing options...
hen Posted January 20, 2016 Share Posted January 20, 2016 You could just load all assets async to never reach any browser limit. Quote Link to comment Share on other sites More sharing options...
3Dlove Posted January 20, 2016 Author Share Posted January 20, 2016 Ok, thanks Dad72, your solution works ;-) 1 hour ago, Dad72 said: Maybe this link can help you: http://stackoverflow.com/questions/985431/max-parallel-http-connections-in-a-browser But finally, this is not that the problem : the total downloads take less 10 seconds but all images are displayed after 20 seconds, BJS do blob one after one I have impression ? Quote Link to comment Share on other sites More sharing options...
jerome Posted January 20, 2016 Share Posted January 20, 2016 Actually each image has to be transformed into a texture, then passed to the WebGL context. All this requires some computations. Quote Link to comment Share on other sites More sharing options...
3Dlove Posted January 21, 2016 Author Share Posted January 21, 2016 15 hours ago, jerome said: Actually each image has to be transformed into a texture, then passed to the WebGL context. All this requires some computations. OK, so the only solution to reduce this time is that I resize image from Backend before to send it to frontEnd ? (with power of 2) EDIT : Is it possible to trigger the compilation only after the end of all downloads ? (refer to the following post) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 21, 2016 Share Posted January 21, 2016 You can still manually create your textures, wait for texture.isReady() and then use them with your shader 3Dlove 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.