WebSocket
WebSocket is a protocol that enables real-time, two-way communication between a client (like a web browser) and a server. Unlike traditional HTTP, which requires a new connection for each request, WebSocket maintains a single, open connection. This allows for immediate data exchange, making it perfect for applications like online gaming, live chats, and financial trading.
Key Features:
- Real-Time Communication: Send and receive messages instantly.
- Low Latency: Quick updates without the need to reconnect.
- Efficient: Uses less data during communication compared to standard HTTP.
Different Ways to Add WebSocket
There are several methods to add a WebSocket connection in your application. Below are the primary approaches:
From Main Screen
Users can easily add a WebSocket connection directly from the main screen of the application. This method provides a straightforward interface, allowing for quick setup without navigating through multiple menus.
From the Left-Panel Section
Steps:
- Open the application.
- Click the "+" button in the left panel.
- Select the "Add WebSocket" option from the dropdown.
From the Collection Section
Steps:
- Open the application.
- Click the "Collection" option in the left panel.
- Click on the three dots next to the collection.
- Select the "Add New WebSocket" option from the dropdown.
Using WebSocket Icon in Collection Section
Steps:
- Open the application.
- Click the "Collection" option in the left panel.
- Click on the WebSocket icon.
How to Connect WebSocket
- Enter Connection Details: Input the WebSocket URL, along with any required messages, headers, and parameters.
- Click the Connect Button: After entering all information correctly, click the "Connect" button.
- Confirmation: After a successful connection, you will see a confirmation message on the right side of the window, indicating that the WebSocket is connected and ready for use.
How to Interact with WebSocket
- Enter the Message: Type your message in the correct format.
- Click Send: After composing the message, click the "Send" button.
- Wait for Response: The WebSocket will process the message and respond.
- View Response: Click on the response to view it in the bottom window.
How to Change Response Format, Copy, and Download Responses
- Change Response Format: After opening the response details, click the "Format" dropdown to view the response in different structures.
- Copy the Response: Click the "Copy" icon to copy the response. A toast message will confirm the action.
- Download the Response: Click the "Download" icon to save the response file to your system.
Search, Filter, Scroll, and Delete Messages
Search Messages:
-
Enter your search query in the search box. Results will filter automatically.
-
To clear the search input, click the cross icon.
Filter Messages:
-
Use the "Filter Messages" dropdown to view:
- All Messages: Shows all messages.
- Sent: Displays only sent messages.
- Received: Displays only received messages.
Scroll:
- Scroll to Bottom: Click the bottom arrow to navigate to the latest messages.
- Scroll to Top: Click the top arrow to go to the first message.
Delete Messages:
- Click the delete icon to remove all messages. A confirmation toast will appear.
Clear Input:
- Click "Clear Input" to erase the message input field. A confirmation toast will appear.
How to Save WebSocket for Future Use
You can save the WebSocket connection in a folder or collection to use later. This way, you won’t have to enter your credentials again, making it quicker and easier to reconnect when you need to.
- Click Save: After setting up the WebSocket, click the "Save" button.
- Select a Collection: Choose an existing collection or create a new one.
- Choose a Folder: Select a folder to store the WebSocket.
- Edit WebSocket Name: Optionally, change the default name.
- Add a Description: Optionally, add a description for easier identification.
- Click Save: Confirm and save the WebSocket for future use.