Coder Social home page Coder Social logo

Handle streaming messages about extwitter HOT 6 CLOSED

parroty avatar parroty commented on May 31, 2024
Handle streaming messages

from extwitter.

Comments (6)

parroty avatar parroty commented on May 31, 2024

Yes, I haven't been able to support these message types yet... Thinking to add an option to receive messages in addition to standard tweet payloads, as existing I/F just sends tweets.

like,

pid = spawn(fn ->
  stream = ExTwitter.stream_filter(track: "twitter", receive_messages: true)
  for message <- stream do
    case message do
      tweet = %ExTwitter.Tweet{} ->
        IO.puts tweet.text
      warning = %ExTwitter.Streaming.StallWarning{} ->
        IO.puts warning.code
    end
  end
end)

or something.

from extwitter.

parroty avatar parroty commented on May 31, 2024

I've pushed experimental implementation for several message, but haven't been able to test all of the message. In the case you know good way to test (reproduce message), please let me know.

from extwitter.

mroth avatar mroth commented on May 31, 2024

Which messages have you not been able to reproduce? I can look into trying to help generate them.

from extwitter.

parroty avatar parroty commented on May 31, 2024

Thanks. I think I couldn't reproduce stall warning, though I tried with slowing down stream read (through sleeping). At the moment, I implemented / tested based on the example in the twitter page in the above.

from extwitter.

mroth avatar mroth commented on May 31, 2024

Did you send stall_warnings: true parameter to Twitter endpoint when initiating the stream? Looks like perhaps they only send them in that case (and only once "about every 5 minutes" which means they may not be consistent..).

(That said, the mocked test for this looks good to me!)

from extwitter.

parroty avatar parroty commented on May 31, 2024

Thanks for the information. I wasn't aware about the 5 minutes part, so retried with the following and left for a while. But seems not receiving (though not sure if this sleep is reasonable).

stream = ExTwitter.stream_filter(track: "twitter", stall_warnings: true, receive_messages: true)
for message <- stream do
  case message do
     warning = %ExTwitter.Model.StallWarning{} ->
       IO.inspect warning
     _ ->
       :timer.sleep(1000)
  end
end

Please let me close at the moment (with mock test), and reopen if any issue are found.

from extwitter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.