Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Purpose
Important
Choosing a WebSocket API on Windows — There are multiple WebSocket options. Choose based on your application type:
| API | Best for | Notes |
|---|---|---|
| WinHTTP WebSocket (WinHttpWebSocketSend, etc.) | Services, server-side code, C/C++ apps needing WebSocket over WinHTTP | Integrates with WinHTTP proxy/auth; requires Windows 8+. Recommended for Win32 service scenarios. |
| Windows.Networking.Sockets (MessageWebSocket, StreamWebSocket) | UWP apps, modern C++/WinRT desktop apps | Highest-level API; handles framing and TLS. Apps must implement their own reconnection logic. Recommended for new desktop/UWP apps. |
| WebSocket Protocol Component (this API — websocket.dll) | Custom transport implementations that need only protocol framing/parsing | Low-level: does not handle I/O, HTTP upgrade, authentication, or proxy. You must provide your own transport (typically raw Winsock + TLS). |
| System.Net.WebSockets (.NET) | .NET applications | Managed, async-first, cross-platform. Use ClientWebSocket for clients. |
| Third-party libraries (libwebsockets, Boost.Beast, etc.) | Cross-platform C/C++ | Not Windows-specific; useful when targeting multiple platforms. |
For most applications, WinHTTP WebSocket (services/Win32) or Windows.Networking.Sockets (modern apps) is the correct choice. Use the low-level WebSocket Protocol Component API only if you need custom framing over a transport you fully control.
The WebSocket Protocol Component API enables asynchronous, bi-directional communication channels over HTTP that work across existing network intermediaries. With the WebSocket Protocol Component API, a client uses HTTP to communicate with a server, and then both sides switch to using the underlying protocol that HTTP was layered on (such as TCP or SSL). The goal is to first use HTTP to traverse over network intermediaries, and then use the established end-to-end underlying TCP/SSL channel for bi-directional application communication. The WebSocket protocol [WSPROTO] is defined at the IETF, while an associated Javascript API (WebSockets) is defined at the WHATWG.
In this section
| Topic | Description |
|---|---|
| WebSocket Protocol Component API Data Types |
The WebSocket Protocol Component API defines these data types. |
| WebSocket Protocol Component API Enumerations |
The WebSocket Protocol Component API defines these enumerations. |
| WebSocket Protocol Component API Functions |
The WebSocket Protocol Component API defines these functions. |
| WebSocket Protocol Component API Structures |
The WebSocket Protocol Component API defines these structures. |
Developer audience
The WebSocket Protocol Component API is designed for use by use by C/C++ programmers. Familiarity with HTTP and Windows networking is required.
Note
The preferred way to use the WebSocket protocol on Windows is through the Windows HTTP Services (WinHTTP) API or the Windows.Networking.Sockets namespace.
Run-time requirements
The WebSocket Protocol Component API requires Windows 8 and later versions of the Windows operating system. The APIs can be dynamically linked through websocket.dll.
Note
websocket.dll provides support for client and server handshake related HTTP headers, verifies received handshake data, and parses the WebSocket data stream. It does not handle any HTTP-specific operations (redirection, authentication, proxy support) nor perform any I/O operations (sending or receiving WebSocket stream bytes).