RTMP – Real Time Messaging Protocol
RTMP stands for Real Time Messaging Protocol and is a proprietary protocol developed by Adobe, it is characterized by maintaining a single persistent connection per channel and use synchronous steps, that means that each step must be completed before the next step execution
RTMP (except RTMFP) is a TCP-based protocol which maintains persistent connections and allows low-latency communication. To deliver streams smoothly and transmit as much information as possible, it splits streams into fragments and their size is negotiated dynamically between the client and server while sometimes it is kept unchanged: the default fragment sizes are 64-bytes for audio data, and 128 bytes for video data and most other data types.
The RTMP defines several channels on which packets may be sent/received, and which operate independently of each other. For example, there is a channel for handling RPC requests and responses, a channel for video stream data, a channel for audio stream data, a channel for out-of-band control messages (fragment size negotiation, etc.), and so on, the model of this protocol is not a classis request-response, but rather a messaging model (publish/subscribe), Its common use is streaming video and audio data to and from a Flash client.
RTMP body data can vary from AMF0/3 format to a binary format – depends on the content type, and same as web protocol each RTMP message contains header and body. The header define a set of properties: header size, channel Id, time stamp, body length, data type and stream id, however not every header define all those properties – it depends on the header size property, header size and channel id are the only properties defined in every header.
RTMP body can be from many types: invoke, video data, audio data, flex message, and others – about 20 types, some types imply binary data (video/audio), some imply AMF structure data, and some imply a structure that hasn’t been understood yet
The RTMP communication is performed between the Flash player and the server, and is working in one of five possible modes: over TCP, over HTTP, over HTTPS, enhanced and encrypted “raw” RTMP or enhanced and encrypted RTMP over HTTP
- RTMP – Over TCP: The "plain" protocol which works on top of TCP and uses port number 1935 by default.
- RTMPT – Over HTTP: Is encapsulated within HTTP requests to traverse firewalls. The encapsulated session may carry plain RTMP, RTMPS, or RTMPE packets within
- RTMPS – Over HTTPS: Is RTMP over a secure SSL connection using HTTPS.
- RTMPE – Enhanced and Encrypted Version of RTMP using Adobe’s own security mechanism. While the details of the implementation are proprietary, the mechanism uses industry standard cryptography primitives. Unfortunately the design of RTMPE is fundamentally flawed and provides no actual security in itself.
- RTMPTE – Like RTMPE, over HTTP