# Websocket

### /wss/listenSubmission

This method can track submission judging almost in real-time.

#### Query parameters

<table><thead><tr><th width="135">Name</th><th>Description</th></tr></thead><tbody><tr><td><code>id</code></td><td>ID of submission you want to listen for.</td></tr><tr><td><code>token</code></td><td>Your access token.<br>Required here because WSS connections can't use headers.</td></tr><tr><td><code>language</code></td><td>Language required to get text verdict representation.<br>Required here because WSS connections can't use headers.</td></tr></tbody></table>

When connection is established, you will start receiving plaintext numbers:

<figure><img src="/files/76Aoek13f1XpSqTP4xJD" alt=""><figcaption><p>Websocket connection in Chrome DevTools</p></figcaption></figure>

Thats a test number on which submission is being judged right now. You can display it as live counter, just as in sort-me.org after submission.

<figure><img src="/files/6Z2wKc39z7oMLDgbfoEU" alt=""><figcaption></figcaption></figure>

When judging is done, you receive a JSON with results in the same connection:

```json
{
    "points": 100,
    "verdict": 1,
    "verdict_text": "Accepted",
    "worst_metrics": {
        "time": 25,
        "memory": 0
    },
    "subtasks": [
        {
            "points": 50,
            "worst_metrics": {
                "time": 25,
                "memory": 0
            }
        },
        {
            "points": 50,
            "worst_metrics": {
                "time": 19,
                "memory": 0
            }
        }
    ]
}
```


---

# 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://docs.sort-me.org/api/websocket.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.
