Luuzzi
June 8, 2022, 10:19pm
1
Hello, at the moment I am implementing my API for trading on the binance spot market. And a further answer to my question will give me an push in choosing a facade.
Is it possible to keep-alive a persistent connection by using http-client on api.binance.com ? Or do I need to constantly open and close them. Or is there some interval after which the connection with the http-client breaks?
Regards
dino
June 9, 2022, 12:40am
2
➜ ~ curl -v "https://api.binance.com/api/v3/time"
* Trying 18.65.178.171:443...
* Connected to api.binance.com (18.65.178.171) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
* successfully set certificate verify locations:
* CAfile: /etc/ssl/cert.pem
* CApath: none
* (304) (OUT), TLS handshake, Client hello (1):
* (304) (IN), TLS handshake, Server hello (2):
* (304) (IN), TLS handshake, Unknown (8):
* (304) (IN), TLS handshake, Certificate (11):
* (304) (IN), TLS handshake, CERT verify (15):
* (304) (IN), TLS handshake, Finished (20):
* (304) (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / AEAD-AES128-GCM-SHA256
* ALPN, server accepted to use h2
* Server certificate:
* subject: C=KY; L=West Bay; O=Binance Holdings Limited; CN=*.binance.com
* start date: Feb 16 00:00:00 2022 GMT
* expire date: Mar 19 23:59:59 2023 GMT
* subjectAltName: host "api.binance.com" matched cert's "*.binance.com"
* issuer: C=US; O=DigiCert Inc; OU=www.digicert.com; CN=GeoTrust RSA CA 2018
* SSL certificate verify ok.
* Using HTTP2, server supports multiplexing
* Connection state changed (HTTP/2 confirmed)
* Copying HTTP/2 data in stream buffer to connection buffer after upgrade: len=0
* Using Stream ID: 1 (easy handle 0x7f7aa8010400)
> GET /api/v3/time HTTP/2
> Host: api.binance.com
> user-agent: curl/7.79.1
> accept: */*
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 128)!
< HTTP/2 200
< content-type: application/json;charset=UTF-8
< content-length: 28
< date: Thu, 09 Jun 2022 00:39:29 GMT
< server: nginx
< x-mbx-uuid: 530555d0-c51d-444d-8e72-d9253066189c
< x-mbx-used-weight: 1
< x-mbx-used-weight-1m: 1
< strict-transport-security: max-age=31536000; includeSubdomains
< x-frame-options: SAMEORIGIN
< x-xss-protection: 1; mode=block
< x-content-type-options: nosniff
< content-security-policy: default-src 'self'
< x-content-security-policy: default-src 'self'
< x-webkit-csp: default-src 'self'
< cache-control: no-cache, no-store, must-revalidate
< pragma: no-cache
< expires: 0
< access-control-allow-origin: *
< access-control-allow-methods: GET, HEAD, OPTIONS
< x-cache: Miss from cloudfront
< via: 1.1 05e04c5e15a87c619e820e333918b7f2.cloudfront.net (CloudFront)
< x-amz-cf-pop: NRT57-P1
< x-amz-cf-id: 0fkmvHpIwiNRdbQPfHSgK4BwyujYM_aELu7GBHTsR1s46aA3tPUldg==
<
* Connection #0 to host api.binance.com left intact
{"serverTime":1654735169550}%
Hope this will be helpful.