HTML and CSS Reference
denominator model of a desktop computer. RFB is therefore a way to remotely access a
framebuffer. For any system with a keyboard, mouse, and screen, there is probably a way
to access it with RFB.
The RFB protocol was designed to have the server to do the “heavy lifting,” enabling
the client to be simple and thin. Clients built against the RFB protocol are also stateless,
meaning that if the client disconnects and reconnects, the new session does not lose the
state of the framebuffer.
Binary- and Text-Oriented Protocols
Protocols are generally oriented towards binary data or text strings. Binary protocols can be
more compact than text-oriented protocols, and can neatly and naturally embed arbitrary
binary data structures like images, audio and video. Binary protocols are intended to be read
by machines rather than humans, and can optimize the data structure to be sent in any form
to preserve efficiency.
Text-oriented protocols like STOMP and XMPP tend to transmit relatively larger
messages on the wire and, as such, are more expensive to parse when compared with
binary protocols. However, text-oriented protocols can be implemented by virtually any
language, are readable by humans, and have flexible variable length fields. While binary
protocols can be a more efficient way to transport data, text-oriented protocols may give
you more flexibility, and can be easier to implement and deploy.
RFB is a binary protocol that transmits binary image data. The data can be
compressed and can be streamed to and from servers with very high frequency updates.
Image data can be streamed at high frequency from the server; similarly, clients can
generate streams of input events caused by users moving their mice and pressing keys.
These input events are compactly encoded in a binary format that takes very few bytes to
transmit. The WebSocket Protocol can handle binary data or text strings. As such, binary
WebSocket messages are a natural fit for the RFB protocol.
■ wireshark supports analyzing RFb protocol sessions, which can be useful when
debugging a new implementation. For more information, see Chapter 3, where we discussed
examining the webSocket Protocol, and Appendix A, where we discuss dissecting and
debugging webSocket traffic using wireshark.
Choosing to Use RFB over WebSocket
As we discussed in Chapter 4, you can build your own chat protocol; similarly, you could
build your own remote access protocol that only works with your application. But, as we
also mentioned, you would be missing out on the immense benefits of using a widely
used, open, interoperable protocol. For example, there are numerous cross-platform
servers designed for VNC available that are based on RFB, many of which are continually
optimized and enhanced by a growing community of developers. As new operating
systems are developed and versioned, you can work with the community to leverage the
benefits, and focus on what you want your application to do.