7WebSocket Scripting - Chat Demonstration
Fe.'
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 andCis echoed to all connected clients. If left unused the WebSocket isGdisconnected by the server-side application and can be reestablished byentering 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.