---
title: Websockets
source: https://docs.newrelic.com/docs/browser/new-relic-browser/configuration/websockets
---

## What does this feature do?

This allows monitoring the health and traffic of your websockets connections.

A new property is available in the browser agent’s init object called `web_sockets`. This setting controls whether to use the websockets feature in the agent. Available in the Browser Pro or Pro + SPA agent, [version 1.318.0](https://docs.newrelic.com/docs/release-notes/new-relic-browser-release-notes/browser-agent-release-notes/browser-agent-v1.318.0) or greater.

## How do I use it?

To use this feature, you will need to visit your app settings page and turn the `"Enable websockets"` toggle to on. This setting is off by default.

NerdGraph can be used as an alternative to turn the setting on and off. To do so, run a mutation query on the `browserSettings` graphQL object for the `browserWebSockets` property, setting `enabled` to `true` or `false`.

Once enabled, data collection for websockets is automatic after re-deploying the agent. The websockets data is collected as [WebSocket](https://docs.newrelic.com/attribute-dictionary/?dataSource=Browser+agent&event=WebSocket) events including connection metrics, messages received, data sent, and how the connection was closed. Each `WebSocket` instance is tracked independently and emits one event per connection lifetime.

## Additional considerations

-   If [session traces](https://docs.newrelic.com/docs/browser/browser-monitoring/browser-pro-features/session-traces-explore-webpages-life-cycle) are enabled, WebSocket events can be linked through the `sessionTraceId` property as part of your session traces.
