Chapter 3. A Basic Client

Table of Contents

1. Overview
2. The Program
3. Walk-through
4. Building and Running
5. See Also

1. Overview

The client-basic program is the smallest complete libvws WebSocket client. It connects to a server, sends a single text frame and then a small binary message, prints the echoed reply to each, and disconnects. It exercises the core of the synchronous client API — opening a connection, sending a frame and a message, and the blocking receive.

The connection setup uses the examples' vwsx_connect helper, which is simply vws_cnx_new() followed by vws_connect(), exiting with a message on failure. Everything after the connection is opened is done with the real libvws calls.