Create a WebSocket API

WebSocket is a protocol similar to HTTP that is part of the HTML5 specification. It enables simultaneous two-way communication (full-duplex communication) between the client and the server over a single connection.

The WebSocket protocol is designed to achieve the following:

  • Reduce unnecessary network traffic and latency.
  • Allow streaming through proxies and firewalls while simultaneously supporting upstream and downstream communication.
  • Be backward compatible with the pre-WebSocket world by starting up as an HTTP connection before switching to WebSocket frames.

A WebSocket API allows an API creator to expose a WebSocket backend as an API to offer services via a WebSocket protocol while providing OAuth security, Throttling, Analytics, etc.

Follow the instructions below to design a WebSocket API.

  1. Sign in to the API Publisher Portal.


    Example: https://localhost:9443/publisher

    Use your username and password to sign in.

  2. Click CREATE API and then click Design a New WebSocket API.


    The CREATE button will only appear for a user who has the creator role permission.

    Create WebSocket API menu

  3. Enter the detials of the new WebSocket API.

    Field Sample value
    Name EchoWebSocket
    Context /echowebsocket
    Version 1.0

    Use one of the following endpoints.

    • ws://
    • wss://
    Business Plan Gold, Silver

    Create a WebSocket API menu


    The CREATE & PUBLISH option will appear only if the optional fields Endpoint and Business plan(s) are provided by a user who has publisher permission. You need to add a Name, Context, Version, and a valid Endpoint (For non-secured WebSockets enter the protocol as ws:// or for secured WebSockets enter the protocol as wss://) to create the API.


    The overview page of the created WebSocket API appears.

    Overview of WebSocket API

  5. Optionally, enter the endpoint configurations.

    1. Click Endpoint.

    2. Click on the cogwheel icon, which is inline with the endpoint that you need to configure, and update the endpoint related configurations as required.

      For more information, see the following sections on endpoint related configurations.

    View endpoint details

Now, you have successfully created and configured a WebSocket API. Next, let's Publish your API.

What's Next?

Learn more by trying out the tutorial on Creating and Publishing a WebSocket API.