Skip to content

GLSP client library seems to ignore ID field from JSON-RPC #1606

@georghinkel

Description

@georghinkel

I am using @eclipse-glsp version 2.5.0.

I noted that when I send a message from the server to the client, the client always responds with the id "" and ignores the id field sent with JSON-RPC.

GLSP Verbose: 8 : Sent: {"jsonrpc":"2.0","method":"process","params":[{"clientId":"sprotty","action":{"kind":"requestBounds","newRoot":{"id":"9564c1ee-c08c-4df9-8d0f-a059fa13c776","type":"graph","size":{"width":1060,"height":350},"position":{"x":0,"y":0},"children":[{"id":"6ff5437d-4e7d-40d6-ba19-5673f2f29424","type":"StateMachine","size":{"width":60,"height":30},"position":{"x":1000,"y":320},"layout":"vbox","children":[{"id":"c62708de-42ca-41ab-b8f8-585ddfec845b","type":"comp:head","layout":"vbox","children":[{"id":"a85ff455-5de1-439d-b91d-ebb60dd5e187","type":"label:head","text":"New App"}]},{"id":"47c73056-84e3-446b-98c0-912e3c8dfc94","type":"comp"}]}]},"requestId":"_2"}}]}
GLSP Information: 7 : {"id":null,"method":"process"}
GLSP Verbose: 7 : Received: {"jsonrpc":"2.0","method":"process","params":{"clientId":"sprotty","action":{"kind":"computedBounds","responseId":"","bounds":[{"elementId":"a85ff455-5de1-439d-b91d-ebb60dd5e187","newSize":{"width":43.28333282470703,"height":12},"newPosition":{"x":5,"y":5}},{"elementId":"47c73056-84e3-446b-98c0-912e3c8dfc94","newSize":{"width":0,"height":0},"newPosition":{"x":31.641666412353516,"y":28}},{"elementId":"c62708de-42ca-41ab-b8f8-585ddfec845b","newSize":{"width":53.28333282470703,"height":22},"newPosition":{"x":5,"y":5}},{"elementId":"6ff5437d-4e7d-40d6-ba19-5673f2f29424","newSize":{"width":63.28333282470703,"height":33}}],"alignments":[{"elementId":"a85ff455-5de1-439d-b91d-ebb60dd5e187","newAlignment":{"x":21.641666412353516,"y":10}}],"layoutData":[{"elementId":"c62708de-42ca-41ab-b8f8-585ddfec845b","layoutData":{"computedDimensions":{"width":53.28333282470703,"height":22}}},{"elementId":"6ff5437d-4e7d-40d6-ba19-5673f2f29424","layoutData":{"computedDimensions":{"width":63.28333282470703,"height":33}}}]}}}

So far, I had a workaround logic to send requests using the responseId="", but recently, I ran into an issue where two parallel requests needed to be sent. At the moment, I have another workaround logic in place to sequentialize the requests, but it would be nicer to have the issue solved in the GLSP client.

Here are the above messages with improved formatting:

{
  "jsonrpc": "2.0",
  "method": "process",
  "params": [
    {
      "clientId": "sprotty",
      "action": {
        "kind": "requestBounds",
        "newRoot": {
          "id": "9564c1ee-c08c-4df9-8d0f-a059fa13c776",
          "type": "graph",
          "size": { "width": 1060, "height": 350 },
          "position": { "x": 0, "y": 0 },
          "children": [
            {
              "id": "6ff5437d-4e7d-40d6-ba19-5673f2f29424",
              "type": "StateMachine",
              "size": { "width": 60, "height": 30 },
              "position": { "x": 1000, "y": 320 },
              "layout": "vbox",
              "children": [
                {
                  "id": "c62708de-42ca-41ab-b8f8-585ddfec845b",
                  "type": "comp:head",
                  "layout": "vbox",
                  "children": [
                    {
                      "id": "a85ff455-5de1-439d-b91d-ebb60dd5e187",
                      "type": "label:head",
                      "text": "New App"
                    }
                  ]
                },
                { "id": "47c73056-84e3-446b-98c0-912e3c8dfc94", "type": "comp" }
              ]
            }
          ]
        },
        "requestId": "_2"
      }
    }
  ]
}

and the response from GLSP Client:

{
  "jsonrpc": "2.0",
  "method": "process",
  "params": {
    "clientId": "sprotty",
    "action": {
      "kind": "computedBounds",
      "responseId": "",
      "bounds": [
        {
          "elementId": "a85ff455-5de1-439d-b91d-ebb60dd5e187",
          "newSize": { "width": 43.28333282470703, "height": 12 },
          "newPosition": { "x": 5, "y": 5 }
        },
        {
          "elementId": "47c73056-84e3-446b-98c0-912e3c8dfc94",
          "newSize": { "width": 0, "height": 0 },
          "newPosition": { "x": 31.641666412353516, "y": 28 }
        },
        {
          "elementId": "c62708de-42ca-41ab-b8f8-585ddfec845b",
          "newSize": { "width": 53.28333282470703, "height": 22 },
          "newPosition": { "x": 5, "y": 5 }
        },
        {
          "elementId": "6ff5437d-4e7d-40d6-ba19-5673f2f29424",
          "newSize": { "width": 63.28333282470703, "height": 33 }
        }
      ],
      "alignments": [
        {
          "elementId": "a85ff455-5de1-439d-b91d-ebb60dd5e187",
          "newAlignment": { "x": 21.641666412353516, "y": 10 }
        }
      ],
      "layoutData": [
        {
          "elementId": "c62708de-42ca-41ab-b8f8-585ddfec845b",
          "layoutData": {
            "computedDimensions": { "width": 53.28333282470703, "height": 22 }
          }
        },
        {
          "elementId": "6ff5437d-4e7d-40d6-ba19-5673f2f29424",
          "layoutData": {
            "computedDimensions": { "width": 63.28333282470703, "height": 33 }
          }
        }
      ]
    }
  }
}

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions