Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by eaguayo_sav · Jan 08, 2017 at 06:22 PM · wwwwebrequesthttpssslheaders

How to avoid reestablishing an HTTPS request, use Connection: Keep-Alive or reuse WWW object?

Hi

I have an application which uses HTTPS to communicate with an API. Establishing the initial handshake and connection is killing our performance.

When profiling with Apache's ab tool the time it takes to establish a new connection to my web serve ranges anywhere from 250ms-400ms. This is consistent with our customers experience with our app, they complain its slow.

When using keep-alive and profiling the initial connection is anywhere from 250ms-400ms, but all subsequent connections are, as expected, close-to-or 0ms.

I can find 0 documentation on how if Unity will respect the Connection: keep-alive header, which I am not hopeful of given it disposes of a WWW connection).

Is there a way to reuse a WWW connection, make Unity respect the Connection: keep-alive header (and thus not reestablish the hand shake with each new instance) or another method?

I found this Unity employee state they are "working on it" for the UnityWebRequest class but that was a year ago and "noted" is "noted" is the developer equivalent of a blow off. The official documentation still states you can not set that header.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image primebit · Apr 04, 2018 at 11:37 AM 0
Share

Hello, maybe you found a solution to this problem? We need this too.

2 Replies

· Add your reply
  • Sort: 
avatar image
-1

Answer by Bunny83 · Apr 04, 2018 at 02:27 PM

No. The WWW class as well as the UnityWebRequest represent a single request / response. The reuse of an HTTP or HTTPS connection only makes sense in an actual HTTP client which actually holds certain persistent data (including cookies). Of course it may depend on your target platform what classes you can use. The HTTPClient may not work on WebGL. In this case you may want handle AJAX requests directly in Javascript. Keep in mind that keep-alive always has a time-out delay. So you can't keep the connection forever. Some servers only have a keep alive timeout of a few seconds. It's mainly meant to serve several resources of the same page as a "chunk" without creating a new connection for every image / css / js file. If you are in full control of the server you can of course set the keep alive time to something longer. Though note that TCP connections might have their own timeout. Especially when you go through a NAT router you don't want to keep connections too long without any communication as the "NAT hole" the router creates might be closed by the router. So you might need some heartbeat requests in regular intervals to actually keep the connection alive.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by andywatts · Apr 24, 2018 at 11:44 AM

This asset appears to have keep alive support.

https://forum.unity.com/threads/best-http-released.200006/

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I add a header and a file at the web request at the same time? 0 Answers

HTTPS: ignore untrusted certificate? 1 Answer

Unity 5.6.7 - UnityWebRequest SSL/HTTPs 2 Answers

How to validate SSL certificate before sending data via https? 1 Answer

How to validate SSL certificates when using HttpWebRequest 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges