Sort Me API
  • 👋Sort Me Documentation
  • API Methods
    • ⚰️Problems
    • 🚲Submissions
    • 🏆Contests
    • 📚Archives
    • ❤️Users
    • 🛰️Websocket
      • /listenSubmission
      • /contestEvents
    • 👾Miscellaneous
  • Tricky moments
    • 🛂Account limits
    • 🔑Authorization
    • 🗃️Pagination
    • 🈂️Localization
    • 🖼️Images
Powered by GitBook
On this page
  1. API Methods
  2. Websocket

/listenSubmission

https://api.sort-me.org/wss/listenSubmission

Last updated 1 year ago

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

Query parameters

Name
Description

id

ID of submission you want to listen for.

token

Your access token. Required here because WSS connections can't use headers.

language

Language required to get text verdict representation. Required here because WSS connections can't use headers.

Message stages

1. Current submission object

This message contains submissions object in the same format as in .

{
    "id": 138888,
    "user": {
        "id": 1,
        "handle": "sadfun",
        "avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
    },
    "task_id": 1,
    "worst_metrics": {
        "time": 0,
        "memory": 0
    },
    "submitted_at": 1672947158,
    "lang": {
        "name": "Python 3.11",
        "highlight": "python",
        "api": "python",
        "ext": "py"
    },
    "test": 0,
    "verdict": 0,
    "verdict_text": "Judging",
    "points": 0
}

Then there are two options:

  1. If verdict is not 0 (judging), then judging is already done, so websocket connection closed, and you will receive no more messages.

  2. If verdict is 0 (judging), then proceed to next messages stage.

2. Test number

In fact, the only useful information that can be changed during judging and before getting a final verdict is test number. Therefore (and also for optimization purposes) you will get only it, without unnecessary JSON abstractions.

When it comes to judging your submission, you will start receiving plaintext numbers:

That's 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.

If you receive number 0, it means that compilation stage has just started.

3. Judged submission object

{
    "id": 138888,
    "user": {
        "id": 1,
        "handle": "sadfun",
        "avatar": "https://pic.sort-me.org/bd62e50c-7cfa-40d8-9009-f4753d696289"
    },
    "task_id": 1,
    "worst_metrics": {
        "time": 896,
        "memory": 14
    },
    "submitted_at": 1672947158,
    "lang": {
        "name": "Python 3.11",
        "highlight": "python",
        "api": "python",
        "ext": "py"
    },
    "test": 0,
    "verdict": 1,
    "verdict_text": "Full solution",
    "points": 100
}

When judging is finished, you receive a submission preview again, in the same format as in .

🛰️
stage 1
Websocket connection in Chrome DevTools
/submissions/get