Skip to content

Streaming Data With FS2 #2435

@SarpongAbasimi

Description

@SarpongAbasimi

Hey 👋🏿

I am trying to stream data from the twitter api https://api.twitter.com/2/tweets/sample/stream
Ref - https://developer.twitter.com/en/docs/twitter-api/tweets/sampled-stream/api-reference/get-tweets-sample-stream

For the client I have this

Screen Shot 2021-06-05 at 18 54 22

with sample tweet being

final case class Id(id: Int)                   extends AnyVal  
final case class Text(text: String)            extends AnyVal
final case class Data(id: Id, text: Text)
final case class SampleTweet(data: Data) extends Tweet

but when I make a request, I get this error expected eof got '{"data...' (line 2, column 1)

There isn't a comma , after each data. (I think that is the reason for the error)

Screen Shot 2021-06-05 at 18 46 34

This makes me think that I am probably not handling the stream well. Please is there a better way to handle streams in fs2?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions