Skip to content
This repository was archived by the owner on Mar 16, 2022. It is now read-only.
This repository was archived by the owner on Mar 16, 2022. It is now read-only.

Empty streamed responses are not actually connected #493

@pvlugter

Description

@pvlugter

The presence part of the chat sample uses stream connection and cancellation and a Vote CRDT to track online presence. This is currently not working: cancelling a call to the connect method doesn't cause a stream cancel event. This is since support for metadata was added (#366).

The metadata support for streamed methods uses the first streamed response message to extract the metadata to put into response headers, and then connects the response stream. The connect method in the presence sample doesn't send any messages, so it doesn't connect the stream, so it can't be cancelled.

A workaround to get the chat example working is to add a return {}; to the end of the connect method, so that it sends an initial empty response and is connected.

Given that we're putting headers in the response and these are extracted from the first message, at the moment we can't also connect a possibly empty stream body to the response, as we can't return a response until we have the metadata for headers. So we now have a new requirement that streamed responses at least send an initial message to be connected.

We should either update the samples and document this (for the next released version of Cloudstate) or change the approach to support empty streams again.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions