# HistoryCommand.cursor

**URL:** <https://community.bluescape.com/t/historycommand-cursor/4662>\
**Category:** Developer\
**Created:** [September 27, 2023, 2:37pm UTC](https://community.bluescape.com/t/historycommand-cursor/4662 "2023-09-27T14:37:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![kkoechley](https://sea1.discourse-cdn.com/bluescape/user_avatar/community.bluescape.com/kkoechley/32/2474_2.png) [@kkoechley](https://community.bluescape.com/u/kkoechley)\
**Post date:** [September 27, 2023, 5:25pm UTC](https://community.bluescape.com/t/historycommand-cursor/4662/2 "2023-09-27T17:25:34Z")

</div>

Hi @Amerehei,

With our graphQL subscriptions, you can use the [cursor](https://community.bluescape.com/t/graphql-subscriptions/2018) from the last known subscription event as an optional argument to return all the events from the last cursor.

If you want to know the timestamp of the cursor - you can decode it with a jwt decoder.

**For example:**

1. sample initial subscription connection:

```auto
subscription mySubscriptionTest($workspaceId:String! ){
  commands(workspaceId:$workspaceId){
    __typename
    ... on CreateElementCommand{
      __typename
      workspaceId
      actorId
      actorType
      clientId
      cursor
      element{
        __typename
        id
        boundingBox{
          x
          y
          width
          height
        }
        traits
        reactions{
          id
          type
          unicode
          actorId
        }
        
      }
    }
    
    ... on UpdateElementCommand{
      workspaceId
      elementId
      cursor
      actorId
      actorType
      clientId
      
      data{
        __typename
        ... on UpdateShape{
          transform{
            x y
          }
        }
      }
    }
  }
}

```

with sample event returned:

```auto
{
  "data": {
    "commands": {
      "workspaceId": "bEu943lPQw7XWeh1pPHN",
      "elementId": "65145384d8f0dc63063907f1",
      "cursor": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjE2OTU4MzEyMTQ3MzktMCIsImV4cCI6MTY5NTkxNzYxNH0.vr7yR5rtn_cFjkqlZ0V05QeuJ4DlxlKvdqKbv9WDd1M",
      "actorId": "BC0i0wzZ5Caph7i871Ka",
      "actorType": "USER",
      "clientId": "651452e5394b730017bf684b",
      "data": {
        "__typename": "UpdateShape",
        "transform": {
          "x": -401,
          "y": -179
        }
      }
    }
  }
}

```

1. You can then store the cursor, or decode the cursor with jwt decoder:  
`"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjE2OTU4MzEyMTQ3MzktMCIsImV4cCI6MTY5NTkxNzYxNH0.vr7yR5rtn_cFjkqlZ0V05QeuJ4DlxlKvdqKbv9WDd1M"`

decoded is:

```auto
{
  "id": "1695831214739-0",
  "exp": 1695917614
}

```

`exp` is in epoch format, `1695917614`, or:  
`Thu Sep 28 2023 18:13:34 GMT+0200 (Central European Summer Time)`

1. If you want to get all the events that you missed since Thu Sep 28 2023 18:13:34 GMT+0200 (Central European Summer Time), simply add the cursor when reconnecting:

```auto
subscription mySubscriptionTest($workspaceId:String! ){
  commands(workspaceId:$workspaceId, cursor:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjE2OTU4MzEyMTQ3MzktMCIsImV4cCI6MTY5NTkxNzYxNH0.vr7yR5rtn_cFjkqlZ0V05QeuJ4DlxlKvdqKbv9WDd1M"){
    __typename
    ... on CreateElementCommand{
      __typename
      workspaceId
      actorId
      actorType
      clientId
      cursor
      element{
        __typename
        id
        boundingBox{
          x
          y
          width
          height
        }
        traits
        reactions{
          id
          type
          unicode
          actorId
        }
        
      }
    }
    
    ... on UpdateElementCommand{
      workspaceId
      elementId
      cursor
      actorId
      actorType
      clientId
      
      data{
        __typename
        ... on UpdateShape{
          transform{
            x y
          }
        }
      }
    }
  }
}

```

The response will return all events from the cursor time, and maintain the subscription socket connection to also stream any new events.

---

_[View the full topic](https://community.bluescape.com/t/historycommand-cursor/4662)._
