WebSocket Scripting  —  Chat Demonstration
Chatter: [closed]
Handle:

Description [+]

This (must be a classic) demonstrator for the asynchronous, bi-directional network channel provided by a WebSocket.

To begin, enter a nick-name into the handle field. This is replaced with a chat field and a WebSocket connection will be established with the server-side application (script). This application obviously handles multiple, concurrent clients. The entered text is sent to the chat application and is echoed to all connected clients. An entered question mark displays all participants. If left unused the WebSocket is disconnected by the server-side application and can be reestablished by entering further chat.

This demonstration is JavaScript-driven at the browser end

WASD_ROOT:[SRC.WEBSOCKET]WS_CHAT.HTML

and uses a WebSocket protocol application (script) at the WASD server end

WASD_ROOT:[SRC.WEBSOCKET]WS_CHAT.C

All of these interactions can be observed using the WASD WATCH facility; [x]CGI, [x]DCL and [x]Network Data items.

Configuration [+]

The script is a native WebSocket protocol application and so the executable should only need placing in the script directory.

To effectively display multiple clients the script must rely on there being only a single instance of it executing (a particular issue when employing multiple WASD instances). Generally the server will only need to instantiate a single WS_CHAT script to handle multiple clients, however there is a small window when the client request is being accepted by the script where it is unavailable.

Suppress host name lookup by defining the logical name WS_CHAT_NO_LOOKUP.