WebSocket JavaScript Echo Demo

A JavaScript client for WebSocket that sends messages to the server which echoes them back.

The source code for this demo is available on GitHub: kaazing/kaazing-client-javascript-demo
 

Details

In the demo, enter the connection URL in the Location field and press Connect. If you don't have your own KAAZING Gateway running, you can connect to ws://sandbox.kaazing.net/echo. You can also use ws://echo.websocket.org which is hosted on http://websocket.org/echo.html.

Secure connectivity

Both sandbox.kaazing.net and echo.websocket.org are configured for secure connectivity, so you can also connect to wss://sandbox.kaazing.net/echo or wss://echo.websocket.org. (See the difference? The scheme in those URLs changed from ws:// to wss://. This is like the difference between http:// and https://.)

In fact, connecting securely is the recommended configuration for communication over the Web to remove interference from intermediaries like firewalls and proxies.

Running in your own environment

If you have a KAAZING Gateway running locally, you can connect to it by setting the Location to your URL, such as ws://localhost/echo. You can change localhost to whatever hostname or IP address your gateway is configured to use.

If not already configured, your gateway will need an echo service like the following:

<service>
    <name>echo</name>
    <description>Simple echo service</description>
    <accept>ws://localhost:80/echo</accept>
    <type>echo</type>
</service>


websocket.org is powered by Kaazing © | Copyright | All Rights Reserved.