Skip to content

Handle client subscribing/unsubscribing multiple times #60

@vasyas

Description

@vasyas

The client is implemented to subscribe to a particular combination of itemName/parameters only once. However, due to the network delays, subscribe/unsubscribe calls may come unsynced. The server should handle it.

Log fragment:

    LOG  RemoteSubscriptions.addSubscription {"cached": null, "consumers": [[Function anonymous]], "parameters": [{"pk": 4987627}], "queue": []}
    LOG  RemoteSubscriptions.paused
LOG  OUT:Subscribe 'charging/charging' {"pk": 4987627}
    LOG  IN:Subscribe 'charging/charging' {"amount": 0, "chargeBoxPk": 291, "charged": 0, "clientPaymentMethod": null, "connectorPk": 12106594, "created": 2024-04-24T17:47:31.000Z, "duration": 0, "instantPower": null, "isInvoiceAvailable": true, "meters": null, "parkingDuration": 0, "pk": 4987627, "reserveExpiration": null, "start": 2024-04-24T17:47:31.000Z, "startError": null, "startPhase": "Car", "status": "starting", "stop_timestamp": null}
    LOG  RemoteSubscriptions.unpaused
    LOG  WebSocket message ["charging/charging",{"pk":4987627,"created":"2024-04-24T17:47:31.000Z","status":"starting","start":"2024-04-24T17:47:31.000Z","stop_timestamp":null,"charged":0,"connectorPk":12106594,"chargeBoxPk":291,"amount":0,"duration":0,"parkingDuration":0,"reserveExpiration":null,"instantPower":null,"startPhase":"Car","startError":null,"meters":null,"clientPaymentMethod":null,"isInvoiceAvailable":true},{"pk":4987627},{"parent":"00-9f763dcb8ec3027426e41a6eaf35c20e-512779af2bdc45bd-01"}]
    LOG  IN:Update 'charging/charging' {"amount": 0, "chargeBoxPk": 291, "charged": 0, "clientPaymentMethod": null, "connectorPk": 12106594, "created": 2024-04-24T17:47:31.000Z, "duration": 0, "instantPower": null, "isInvoiceAvailable": true, "meters": null, "parkingDuration": 0, "pk": 4987627, "reserveExpiration": null, "start": 2024-04-24T17:47:31.000Z, "startError": null, "startPhase": "Car", "status": "starting", "stop_timestamp": null}
    LOG  WebSocket message ["charging/charging",{"pk":4987627,"created":"2024-04-24T17:47:31.000Z","status":"active","start":"2024-04-24T17:47:39.000Z","stop_timestamp":null,"charged":0,"connectorPk":12106594,"chargeBoxPk":291,"amount":0,"duration":0,"parkingDuration":0,"reserveExpiration":null,"instantPower":null,"startPhase":"Car","startError":null,"meters":null,"clientPaymentMethod":null,"isInvoiceAvailable":true},{"pk":4987627},{"parent":"00-ebc54ea9362e6f63ea0ac86f05b8a9b3-d358f50d6c7dd5e9-01"}]
    LOG  IN:Update 'charging/charging' {"amount": 0, "chargeBoxPk": 291, "charged": 0, "clientPaymentMethod": null, "connectorPk": 12106594, "created": 2024-04-24T17:47:31.000Z, "duration": 0, "instantPower": null, "isInvoiceAvailable": true, "meters": null, "parkingDuration": 0, "pk": 4987627, "reserveExpiration": null, "start": 2024-04-24T17:47:39.000Z, "startError": null, "startPhase": "Car", "status": "active", "stop_timestamp": null}
    LOG  RemoteSubscriptions.removeSubscription {"cached": {"amount": 0, "chargeBoxPk": 291, "charged": 0, "clientPaymentMethod": null, "connectorPk": 12106594, "created": 2024-04-24T17:47:31.000Z, "duration": 0, "instantPower": null, "isInvoiceAvailable": true, "meters": null, "parkingDuration": 0, "pk": 4987627, "reserveExpiration": null, "start": 2024-04-24T17:47:39.000Z, "startError": null, "startPhase": "Car", "status": "active", "stop_timestamp": null}, "consumers": [[Function anonymous]], "parameters": [{"pk": 4987627}], "paused": false, "queue": []}
LOG  OUT:Unsubscribe 'charging/charging' {"pk": 4987627}
    LOG  RemoteSubscriptions.addSubscription {"cached": null, "consumers": [[Function anonymous]], "parameters": [{"pk": 4987627}], "queue": []}
    LOG  RemoteSubscriptions.paused
LOG  OUT:Subscribe 'charging/charging' {"pk": 4987627}
    LOG  IN:Unsubscribe 'charging/charging' undefined
    LOG  IN:Subscribe 'charging/charging' {"amount": 0, "chargeBoxPk": 291, "charged": 0, "clientPaymentMethod": null, "connectorPk": 12106594, "created": 2024-04-24T17:47:31.000Z, "duration": 0, "instantPower": null, "isInvoiceAvailable": true, "meters": null, "parkingDuration": 0, "pk": 4987627, "reserveExpiration": null, "start": 2024-04-24T17:47:39.000Z, "startError": null, "startPhase": "Car", "status": "active", "stop_timestamp": null}
    LOG  RemoteSubscriptions.unpaused
    
    ...Expecting updates here but they don't come

Related server logs:

subscriptions.addSubscription charging/charging { pk: 923 }
subscriptions.addSubscription charging/charging { pk: 923 }
subscriptions.unsubscribe charging/charging { pk: 923 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions