Design a WebSocket API¶
WebSocket is a protocol similar to HTTP and 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.
-
Sign in to WSO2 API Cloud. This opens the API Publisher portal.
-
Close the interactive tutorial that starts automatically if you are a first-time user, and then click ADD NEW API.
-
Select Design a New WebSocket API and then click Start Creating.
-
Specify the following as details of the new WebSocket API.
-
On the Design tab, specify the following and then click Next: Implement.
Field Sample value Name EchoWebSocket Context /echowebsocket Version 1.0 -
On the Implement tab, click Managed API to expand the section, specify the following and then click Next: Manage:
Endpoint Use one of the following endpoints.
- ws://echo.websocket.org:80
- wss://echo.websocket.org:443
-
On the Manage tab, under Throttling Settings, select
Goldandsilveras the Subscription Tiers.
-
-
Click Save. This displays the overview page of the created WebSocket API.
Now you have successfully created and configured a WebSocket API, which you can publish to the API Store.
Top