1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-03-04 11:08:05 +01:00

Add information about WebSocket subprotocol

This commit is contained in:
Ben 2024-03-21 10:46:56 +01:00
parent 8658be8faa
commit e13def41e5

View file

@ -76,9 +76,21 @@ Stratum over an HTTP connection with SSL/TLS. Just the same as normal HTTP, but
Stratum over a WebSocket connection. Every JSON-RPC message (including batch messages) is sent encapsulated in a WebSocket message and therefore line-feeds are not needed. Still, line-feeds inside the JSON should be encoded as usual. Both client and server can initiate a request on which the other side could respond with a result or an error.
* Default port: <code>8083</code><ref name="extended">This is extended specification information of the Stratum protocol to make it more complete. This information will not be found in any code or specification before this BIP.</ref>
* Default port: <code>8083</code><ref name="extended">This is extended specification information of the Stratum wire protocol to make it more complete. This information will not be found in any code or specification before this BIP.</ref>
* Letter: <code>w</code><ref name="extended"/>
====Subprotocol====
In a WebSocket upgrade request, it is possible to use the <code>Sec-WebSocket-Protocol</code> header to let the WebSocket server know which subprotocol is desired to send over the connection. For Stratum, the value <code>stratum</code> is registered. The use of this header is optional. If the server supports the use of this subprotocol too, it will let the client know by sending a <code>Sec-WebSocket-Protocol</code> header back. If the server doesn't send a subprotocol back, the connection will continue without using one. Use of this feature is fully backwards compatible.
====Example====
<code>
new WebSocket('ws://stratum.example.com:8083',['stratum']); // Open WebSocket with using a subprotocol
new WebSocket('ws://stratum.example.com:8083'); // Open WebSocket without using a subprotocol
</code>
===WebSocket over SSL/TLS===
Stratum over a WebSocket connection with SSL/TLS. Just the same as normal WebSocket, but with SSL/TLS enabled.