Sample 2 - webSocket Support
Jaggery webSockets are enabled in WSO2 DS gadgets, as they allow bi-directional real-time communication between servers and clients.
Follow the instructions below to add a webSocket enabled gadget. Steps 1 explains how to start-up the server and get the sample pre-installed within the server. The sample client application provides a text field and button to send messages, and provides a place where messages from the server are printed. There is a dummy server implemented within this sample that acknowledges all messages and prints the same message with some dummy text.
Let's see how to work with the webSocket related sample.
Step 1: Deploy the sample dashboard
Run the wso2ds-samples
script, which corresponds to your OS, to automatically copy the webSocket sample dashboard (chat dashboard) sample files into the necessary directories, and execute the corresponding start-up script (wso2server.sh/wso2server.bat
) to deploy the webSocket sample. The sample number for this dashboard is ‘2’.
Step 2: View the dashboard
- Access the Dashboard Designer via one of the following URLs.
- For access via HTTP:
http://<DS_HTTP_HOST>:<HTTP_PORT>/portal/ - For access via secured HTTP:
https://<DS_HTTPS_HOST>:<HTTPS_PORT>/portal/
- Example:
http://localhost:9763/portal/
- For access via HTTP:
- Enter admin as the username and password, and click Login.
The dashboard list view appears with the chat dashboard as shown below. - Click View. The dummy chat gadget appears.
- Type a message in the message-box and click Send Me!.
The message that you typed gets appended to the top of the gadget as shown below.