KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Note: Introduction to WebSocket
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: July 24, 2023
This technical article is restricted to partners Only. Login with your Partner account to have full access to this article!!!
Log In


On the modern web, real-time client updates are essential for applications that deal with regularly changing data, requiring constant communication between servers and clients. With the arrival of v20 comes a new way to manage communications between 4D and web clients. WebSocket technology provides a way to establish seamless, two-way communications that allow 4D Web Server to update web clients, and vice versa, instantaneously. This new feature is now available via the new WebSocketServer and WebSocketConnection classes.

This technical note will discuss how these classes work and how to use them to create a WebSocket server and transmit real-time data to clients. This technical note will also go over what WebSocket protocol is, some common use cases, and how it compares and contrasts to the traditional HTTP approach. In addition, this technical note will provide an example application that demonstrates the basic use of WebSocket technology.