7WebSocket Scripting - Chat Demonstration
FeEJ.'
WebSocket Scripting  —  Chat Demonstration
Chatter:[closed]
Handle:C

y
Description [+]
*
A

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

N

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

A

This demonstration is JavaScript-driven at the browser end

K

WASD_ROOT:[SRC.WEBSOCKET]WS_CHAT.HTML

P

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

K

WASD_ROOT:[SRC.WEBSOCKET]WS_CHAT.C

K

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


y
Configuration [+]
)
N

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

O

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

Suppress host name lookup by defining the logical name WS_CHAT_NO_LOOKUP.