docs(protocol): write about recv messages in wrac
This commit is contained in:
parent
0875796999
commit
dc2792aab9
@ -26,7 +26,25 @@ export default function Wrac() {
|
|||||||
<Text>
|
<Text>
|
||||||
WRAC (WebSocket Real Address Chat) is a community-made successor to
|
WRAC (WebSocket Real Address Chat) is a community-made successor to
|
||||||
RAC that uses WebSockets instead of TCP. It uses the same requests as
|
RAC that uses WebSockets instead of TCP. It uses the same requests as
|
||||||
RAC, but you should send data in binary format.
|
RAC, but you should send data in binary format. Also, you can use the
|
||||||
|
same connection multiple times, what differs from the usual RAC, where
|
||||||
|
you had to connect the server each time you made some request. That
|
||||||
|
causes some differences in the receiving messages.
|
||||||
|
</Text>
|
||||||
|
<Title id={"receiving-messages"}>Receiving messages</Title>
|
||||||
|
<Text>
|
||||||
|
As the connection now can be keep-alive, and the websocket uses messages
|
||||||
|
for transactions, we can't just do the same as we did in RAC to get the messages.
|
||||||
|
</Text>
|
||||||
|
<Text>
|
||||||
|
Now, to use those packets (<InlineCode>0x01</InlineCode> for normal reading and <InlineCode>0x02</InlineCode> for chunked reading),
|
||||||
|
we need to let the server know that we want to use them, and not send
|
||||||
|
messages (the same packet-ids). The way how to do this is just add the byte <InlineCode>0x00</InlineCode> to the start
|
||||||
|
of packets. For example: <InlineCode>0x00</InlineCode> <InlineCode>0x01</InlineCode> for normal reading.
|
||||||
|
</Text>
|
||||||
|
<Text>
|
||||||
|
This way we can separate the packets that receive data from the packet that receives the total size.
|
||||||
|
In this sense, WRAC solves a big problem with usual RAC.
|
||||||
</Text>
|
</Text>
|
||||||
<Footer />
|
<Footer />
|
||||||
</main>
|
</main>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user