# Websockets

Build interactive HTML 5 application using Dataloy Websockets.

It is possible to open a Websocket to get notified when there are changes in Dataloy data model.

The concept is very similar to Webhooks, it is possible open a socket to be notified for Creation, Update and Deletion of any of object type of the data model.

The endpoint syntax is:

* **ws\://{url}/ws/rest/WebSocketObjectSubscription/{objectType}/{eventType}/{key}/{token}**

The JSON pushed will have the same structure of the one pushed by Webhooks.

It is possible to customize the JSON sent from the Server to the Client using [*Adjust Number of Fields to be Returned from a Request*](https://dataloy-cloud.atlassian.net/wiki/spaces/VMSINT/pages/923414751/Adjust+Number+of+Fields+to+be+Returned+from+a+Request)*.*

*(The JSON fields can be sent through the open Websocket by the Client to the Server)*

(To get back to the standard fields list a empty JSON ( {} ) can be sent from the client to the server)

It is possible to open a Websocket linked to an Alert Script to be notified when the script is fired and returns true.

The endpoint to use is:

* **ws\://{url}/ws/rest/WebSocketAlertScript/{scriptCode}/{token}**

Passing the script code.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.dataloy.com/api-release-8.23/user-guides/enterprise-functionality/websockets.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
