Insomnia logo
  • Documentation
  • Get Started for Free
    • Introduction to Insomnia
    • Install Insomnia
    • Send Your First Request
    • Import and Export Data
    • Environment Variables
    • Insomnia Accounts
    • Forgotten Passphrase
    • Organizations
    • Enable Enterprise membership
    • Configuring EE SSO
    • Integrating Insomnia Enterprise with Okta SAML 2.0
    • Integrating Insomnia Enterprise with Microsoft Azure/Entra ID SAML 2.0
    • Insomnia Whitelisting Guide for Enterprise Users
    • Insomnia Subscriptions
    • Insomnia Subscription Management
    • Scratch Pad Tutorial
    • Requests
    • Responses
    • Request Collections
    • Request Timeouts
    • Chaining Requests
    • Post CSV Data
    • SOAP Requests
    • gRPC
    • WebSocket Support
    • Get Started with Documents
    • Design Documents
    • Linting
    • GraphQL for OpenAPI
    • Migrate from Designer
    • Unit Testing
    • Stress Testing
    • Insomnia Storage Options Guide
    • Sync with Insomnia Cloud
    • Sync with Git
    • Key Security Features
    • Security Standards
    • Signup and Authentication
    • Analytics Collected
    • End to End Data Encryption
    • Authentication
    • Client Certificates
    • Generate Code Snippet
    • Cookie Management
    • Encoding
    • GraphQL Queries
    • Run in Insomnia Button
    • Key Maps
    • Proxy
    • Introduction to Plugins
    • Context Object Reference
    • Template Tags
    • Hooks and Actions
    • Custom Themes
    • FAQ
    • Application Data
    • SSL Validation
    • Password Recovery
    • Introduction to Inso CLI
    • Install Inso CLI
    • CLI Command Reference
      • inso generate config
      • inso run test
      • inso lint spec
      • inso export spec
      • inso script
      • OpenAPI Spec Reference
      • Using Custom Linting with Inso CLI
    • Configuration
    • Inso CLI on Docker
    • Continuous Integration
    • Kong Declarative Config (for decK)
    • Kong for Kubernetes
    • Insomnia Pre-request Script Overview
    • Insomnia API Mocking Overview

WebSockets

The WebSocket protocol allows data to be passed bi-directionally between client and server over a persistent connection.

Insomnia supports making WebSocket requests alongside REST, GraphQL, and gRPC.

Create a Request

In order to create a new WebSocket request, click on + in the sidebar.

Then, from the dropdown menu, click on the option WebSocket Request. A new request will be created.

To rename the request, double-click on the request tile in the lefthand sidebar. Type in the name of the request and press the enter key.

Making a WebSocket Connection

Enter the WebSocket url in the URL field of your WebSocket request.

You can set an authentication by clicking on the authentication tab, then, clicking on the down arrow to choose the authentication method. Headers can be set in the Header tab.

Click the Connect button next to the URL bar. When there is a successful WebSocket connection, CONNECTED will appear in the URL bar, and the Connect button will display Disconnect. On the event panel, a “Connected Successfully” event log will appear. To see more details about the connection, click Timeline.

Sending a WebSocket Message

Click on the JSON tab. To send raw data, click on the down arrow next to the JSON tab, then click on Raw.

Select the text editor below the Send button. Type the message you want to send, and click Send. On the Events panel, the sent message will be displayed as part of the event log. To see more details about the message, click on the sent message log. Details will appear in the Preview section.

Receiving WebSocket events

Events received from a connected WebSocket connection will display on the Events panel, when they are received. All new events will populate the top of the Events panel and move down as new events come in.

To see details about received events, click on the event in the Events panel. A preview box will open below the events log, containing the received event details.

Environment variables and template tags

The 2022.6 release of Insomnia introduces support for environment variables and template tags within WebSockets. Environment variables and Nunjucks templating can be used in both the URL bar and message body.

Known limitations

  1. Version 2022.6 of Insomnia does not support custom WebSockets.
  2. Insomnia sync of WebSocket requests on teams where members are using Insomnia version 2022.6 and Insomnia versions < 2022.6 will result in the loss of synced WebSocket requests. If your team or Individual setup is using Insomnia Sync to sync WebSocket requests, please ensure that all devices associated are on Insomnia 2022.6.
Edit this page
Report an issue
    COMPANY
  • Insomnia
  • Blog
  • Changelog
  • Pricing
  • Careers
    PRODUCTS
  • Insomnia
  • Inso (CLI)
    RESOURCES
  • Sign In
  • Documentation
  • Support
    LEGAL
  • Privacy Policy
  • Terms & Conditions
© Kong Inc. 2021