From c82a2a11b7ef1a8eb06bf5b8b87097812848609b Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 21 Mar 2024 17:07:05 +0100 Subject: [PATCH] Add information about HTTP Push --- bip-0040.mediawiki | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/bip-0040.mediawiki b/bip-0040.mediawiki index 475a9c507..37525ea00 100644 --- a/bip-0040.mediawiki +++ b/bip-0040.mediawiki @@ -44,7 +44,7 @@ Additionally, it is a convention to give all Stratum methods in the method It is possible to send JSON-RPC messages over different transport protocols, like TCP and HTTP. It is also possible to protect these protocols with SSL/TLS. -''Note: Because HTTP and WebSockets support virtual hosting (Host header or :authority pseudo-header), it is possible to create a server on a single IP address that supports multiple coins by checking the domain name. The same is the case for the transport protocols with SSL/TLS when SNI is used. On plain TCP, virtual hosting is not possible. A similar experience can be reached by using multiple IP addresses. For IPv6, a network of /96 would be enough to support all coins ever listed in SLIP-44. For IPv4, you need all IPv4 addresses that exist, even the invalid ones, so a suggestion is to only use the server only for coins you really need.'' +''Note: Because HTTP and WebSockets support virtual hosting (Host header or :authority pseudo-header), it is possible to create a server on a single IP address that supports multiple coins by checking the domain name. The same is the case for the transport protocols with SSL/TLS when SNI is used. On plain TCP, virtual hosting is not possible. A similar experience can be reached by using multiple IP addresses. For IPv6, a network of /96 would be enough to hypothetically support all coins ever listed in SLIP-44. For IPv4, you would need all IPv4 addresses that exist to do the same, even the invalid ones, so a suggestion is to only use the server only for coins you really need. Also, other ports could possibly be used and in that case, a /16 IP block with all 65536 TCP ports in use will be enough to support all coins. However, because using non-standard ports is not user-friendly, this is also not recommended.'' ===TCP=== @@ -71,7 +71,9 @@ It could be possible that a request or response also has a Content-MD5STRATUM_SESSION is used. If a client sends a request with a cookie, the servers knows exactly which session is used and which notifications to send. + +Servers could send the Stratum-Session-Timeout header to tell the client when a session with the same session id will be seen as a new session by the server. The header contains a number that indicates how many seconds are left. This is different from Expires or Max-Age parameters of the Set-Cookie header, that indicate when a cookie (not necessarily a session) should have been expired by the client. For backwards compatibility, a X-Session-Timeout header with the same value should be sent in those requests too. ====HTTP Poll==== @@ -81,7 +83,9 @@ If no error occurred, the server will respond with a 200 status code and with Stratum-Callback-URL header. This will let the server send notifications using the callback URL without the client needing to send HTTP poll requests in with a very small interval. To disable HTTP Push mode, a regular HTTP poll request should be sent with an additional empty Stratum-Callback-URL header. For backwards compatibility, a X-Callback-URL header with the same value should be sent in those requests too. + +The callback URL will be called when there are notifications. This request is an HTTP POST request with a Content-Type header and a Stratum-Session-ID header. The Stratum-Session-ID contains the same id as the STRATUM_SESSION cookie. This makes it possible to use the callback URL for multiple sessions. The response is of the callback URL is expected to be empty, so any response body will likely be ignored. For backwards compatibility, a X-Session-ID header with the same value should be sent in those requests too. ===HTTP over SSL/TLS===