The rest is the same as with plain websockets. To establish a websocket connection over HTTPS, simply use the TLS URI format.
In all cases, the description string will be a decimal encoded real error code (which may be forward/back-padded with whitespaces for constant length) and can be safely ignored.Įxample implementation: MadelineProto. The close code of websockets will always be 1000 (normal closure), regardless of the actual exit status. Transport errors are transmitted the usual way, as with TCP. When using the websocket transport, transport obfuscation is required. This simply means that all data received and sent through websocket messages is to be treated as a single duplex stream of bytes, just like with TCP. Implementation of the websocket transport is pretty much the same as with TCP: a websocket connection is established to the chosen MTProto server over port 80 using the specified URI format.įraming of payloads is still managed by the chosen MTProto transport protocol, not by websocket messages: the length of MTProto payloads is defined by the MTProto transport protocol, not by the length of the single websocket messages. For example, this is almost always the case for client messages containing RPC queries: the acknowledgment normally arrives with the RPC response. Most frequently, acknowledgments are placed in a container with the next query or response if it is transmitted in short order.
There are no implicit acknowledgments for the TCP transport: all messages must be acknowledged explicitly. The TCP transport is implemented simply by sending the payloads generated by the chosen MTProto transport over a plain TCP socket on ports 80, 443, 5222 or other (a different port number may be returned by help.getConfig).įraming is managed by the chosen MTProto transport protocol. The URI format for connecting to the websocket and HTTP endpoints is the following: Multiple transport protocols are defined:
Enables the delivery of encrypted containers together with the external header (hereinafter, Payload) from client to server and back.