twitter - How to create GenServer child process from spawn function? -
i'm using extwitter stream track tweets in realtime , broadcast them via channel endpoint. create 1 process per event , assign 1 twitter stream listener, when new subscriber join same event previous stream state , receive , broadcast new tweets. how create genserver process from: stream = extwitter.stream_filter(track: hashtags) pid = spawn(fn -> tweet <- stream io.puts tweet.text myapp.endpoint.broadcast! "stream", "tweet", %{tweet: tweet.text} end end) and assign event_id child in following module: defmodule myapp.twitterstream.monitor require iex @moduledoc """ store twitter stream per event_id """ use genserver def create(event_id, hashtags, coords) case genserver.whereis(ref(event_id)) nil -> supervisor.start_child(myapp.twitterstream.supervisor, [event_id, hashtags, coords]) _twitter_stream -> iex.pry # return previous extwitter stream st...