Talk:Event Platform/EventStreams

From Wikitech
Jump to navigation Jump to search

Elixir client

I wrote a streaming parser for Elixir, but wasn't sure whether I should add it to the "examples" section of this page, or perhaps there's a longer list of Wiki SSE clients somewhere else?

Example code depending on the wiki_elixir library:

defmodule EchoSSE do
  def start(:normal, []) do
    WikiSSE.start_link(&EchoSSE.echo_event/1)
  end

  @doc """
  Example callback prints a summary of each message.
  """
  def echo_event(message) do
    data = Poison.decode!(message.data)
    case data["type"] do
      "edit" ->
        IO.puts ~s(#{data["meta"]["dt"]}: #{data["wiki"]} #{data["title"]} edited by #{data["user"]})
      _ ->
        IO.puts ~s(#{data["meta"]["dt"]}: #{data["type"]} event: #{message.data})
    end
  end
end

Awight (talk) 18:58, 9 March 2019 (UTC)

too many requests

{"status":429,"type":"too_many_requests","title":"Too Many Concurrent Connections From Your Client IP","detail":"Your HTTP client is likely opening too many concurrent connections.","method":"GET","uri":"/v2/stream/page-delete,page-move,page-undelete,revision-create?since=2020-07-04T21%3A54%3A21Z"}

Wondering, how I can handle this error. I am running it from the cloud, so I cannot control the number of connections. --Wurgl (talk) 22:15, 4 July 2020 (UTC)