AwesomeHunter
Stop server side streaming after client disconnects
Hello!
I’m trying to implement GRPC Health Checking Protocol. I would like the server to stop streaming to the client after the client disconnects. I found possible solution here, but I can’t find a way to receive a :shutdown message. Below is my attempt:
# health_service.ex
defmodule Grpc.HealthService do
use GRPC.Server, service: Proto.Grpc.Health.V1.HealthService.Service
...
@spec watch(Health.HealthCheckRequest.t(), GRPC.Server.Stream.t()) ::
GRPC.Server.Stream.t()
def watch(request, stream) do
status = get_health_status(request.service)
GRPC.Server.send_reply(stream, status)
receive do
x -> dbg(x)
end
end
...
end
# test.exs
spawn(fn ->
{:ok, channel} = GRPC.Stub.connect("localhost:1234")
request = %Health.HealthCheckRequest{service: ""}
{:ok, _stream} = Health.HealthService.Stub.watch(channel, request);
end)
Process.sleep(10000)
Popular in Questions
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
Hello!
Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
I have followed this StackOverflow post to install the specific version of Erlang.
And When I am running mix ecto.setup then getting fol...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
Hi,
I'm quite new in Elixir and I'm trying to format a string to a PEM format. I have the certificate value like MIIDBTCCAe2...... and ...
New
Hi all
I want to have a unix time, from the current time plus 1 hour.
DateTime.now + 1 hour
How to get it in elixir?
Thanks
New
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: )
Hello all, this is ...
New
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir
iex(2)...
New
Other popular topics
Update:
How to use the Blogs & Podcasts section
You can post links to your blog posts or podcasts either in one of the Official Blog...
New
Hi! May someone helps me, please!
I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!)
This post collects co...
New
Hi folks,
Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
New
I have an umbrella app.
Some of the apps inside depend on other apps in the umbrella, unsurprisingly.
I'm writing a test for one of t...
New
I would like to know what is the best IDE for elixir development?
New
The Elixir Typespec docs show the following syntax for keyword lists in typespecs:
# ...
| [key: type] # keyword lis...
New
Hello everybody,
usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
I will often find my self writing things similar to:
case some_value do
nil -> something()
"" -> something()
_ -> someth...
New
I have a super simple question about elixir - how would I take a file like this
foo bar baz
and output a new file that enumerates th...
New







