question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why I cannot get messages in real-time but only when the browser closes the pending call?

See original GitHub issue

I’m trying to use protobuf-ts with server streaming (https://github.com/improbable-eng/grpc-web/tree/master/go/grpcweb in Golang) but I don’t get messages from server until connection is closed.

I’m using Svelte 3 like this:

<script lang="ts">
	import { onDestroy, onMount } from 'svelte';

  const transport = new GrpcWebFetchTransport({ baseUrl: '/', format: 'binary' });

  const service = new EventServiceClient(transport)

	const abortController = new AbortController();

	onMount(async () => {
		const call = service.flow({}, { abort: abortController.signal });

    for await (const response of call.responses) {
			console.log('got another response!', response);
		}
	});

	onDestroy(() => abortController.abort());
</script>

The call in in pending state for about 2.2 min. After that I get all messages logged in console.

image

I need them in real-time!

Where am I doing wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
timostammcommented, Jul 19, 2021

I am sorry you got stuck with this, but I’m afraid there is nothing we can do from the protobuf-ts side. This needs some debugging of the go code to pinpoint the cause.

0reactions
frederikhorscommented, Jul 6, 2021

XMLHttpRequest has a limitation, the only way for clients to read the response as chunks is to use a text-based format. That’s why grpc-web has the text format.

If I remove that library from my backend server protobuf-ts streaming works with binary format too, not only text.

Here is the code for that middleware: https://github.com/volatiletech/authboss/blob/master/client_state.go#L123.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix problems sending, receiving or connecting to Messages
Make sure your phone has background data turned on for the Messages app. Open your device's settings. Tap Network & internet and then...
Read more >
[Question] what is the reason when the "Browser.close ...
When I run using playwright-java to call browser.close(), ... The pending messages (5 pending messages) get pull off the queue and process ...
Read more >
Life of a message from FCM to the device - The Firebase Blog
1. The device is offline: ... FCM cannot deliver the message if the device is not online. There are many devices that go...
Read more >
Get realtime updates with Cloud Firestore - Firebase
An initial call using the callback you provide creates a document snapshot immediately with the current contents of the single document. Then, each...
Read more >
Pull subscriptions | Cloud Pub/Sub Documentation
In synchronous pull mode, the receiving and processing of messages occur in sequence and are not decoupled from each other. Hence, similar to ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found