Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jul 28 13:21
    pmukhin commented #44
  • Jun 25 07:21
    bellatoris starred Spinoco/fs2-http
  • May 11 14:59
    mfirry commented #43
  • May 05 18:37
    FXHibon starred Spinoco/fs2-http
  • May 03 08:19
    AdamChlupacek synchronize #44
  • May 03 08:19

    AdamChlupacek on upgrade-to-fs2.3

    Address review comments, remove… (compare)

  • May 02 18:40
    AdamChlupacek synchronize #44
  • May 02 18:40

    AdamChlupacek on upgrade-to-fs2.3

    Fix travis dependencies. (compare)

  • May 02 18:35

    AdamChlupacek on 0.5

    Fix travis dependencies. (compare)

  • May 02 18:33
    AdamChlupacek review_requested #44
  • May 02 18:33
    AdamChlupacek review_requested #44
  • May 02 18:33
    AdamChlupacek opened #44
  • May 02 18:27

    AdamChlupacek on upgrade-to-fs2.3

    Setting version to 0.4.0-SNAPSH… Updated to fs2 1.0.0 final Fixes #29 and 16 more (compare)

  • May 02 18:14

    AdamChlupacek on 0.5

    Merge branch 'series/0.4' of gi… (compare)

  • May 02 18:09

    AdamChlupacek on upgrade-to-fs2.3

    Migrate fs2-http to fs2 2.3.0 +… (compare)

  • Apr 23 07:28
    nebtrx starred Spinoco/fs2-http
  • Apr 10 12:43
    mfirry opened #43
  • Apr 10 12:31
  • Feb 21 01:06
    vascorsd starred Spinoco/fs2-http
  • Jan 19 16:13
    jhnsmth commented #42
Pavel Chlupacek
@pchlupacek
@weihsiu yes, unfortunatelly M4 si not binary compatible with M3. We are in process to upgrade this. Currently we are working on last nitpicks on fs2 before releasing RC1, then wwe will release RC1 of fs2-http
sorry for inconvinience
Walter Chang
@weihsiu
Looking forward to the RC version, thanks!
Luciano
@lJoublanc
Hi @pchlupacek , I need to bump the fs2 dependency to 1.0.0-m2 -> 1.0.0. I will be taking a look at this after lunch :meat_on_bone: . Anything I should be aware of? I see you guys are already working on this (or rather M4).
Pavel Chlupacek
@pchlupacek
I plan to have this done over weekend. It should be just simple Timer -> ContenxtShift refactoring. You will help me a lot if you could try PR fs2-crypto is already in 0.4.0 against 1.0.0 fs2.
Luciano
@lJoublanc
Sure, my pleasure. Just so that I understand 100%, you want me to change the fs2-http dep for fs2-crypto 0.4.0-M2 --> 0.4.0, and resolve any problems, and create a PR for fs2-http?
And presumably this is all on branch series/0.4?
Luciano
@lJoublanc
No, I think I've misunderstood. Updating the fs2-crypto dep will pull in fs2-1.0.0 into fs2-http. You just want me to check fs2-crypto compiles and tests run on my setup, and have a play around with it?
Luciano
@lJoublanc
One of the tests is failing due to what I think is the same issue I reported in fs2-http a while ago: #22
Pavel Chlupacek
@pchlupacek
yes, the 0.4.0 will be on 1.0.0, and yes this is what I hope to be avaiable at the end of this weekend
ok I’ll take a look ...
Luciano
@lJoublanc
Ok I've got a fix by explicitly passing the charset. Give me 5 mins and I will create a PR.
Pavel Chlupacek
@pchlupacek
cool excellent
Luciano
@lJoublanc
all done
Pavel Chlupacek
@pchlupacek
perfect
Luciano
@lJoublanc
Will try out your fs2-1.0.0 commits today. Thanks!
Pavel Chlupacek
@pchlupacek
yeh 0.4.0 is build against fs2 1.0.0 let me know how that goes :-)
Luciano
@lJoublanc
Only real change was BodyEncoder constructor. Appears to work fine. Thanks again for your efforts. I'll raise any bugs I find.
Pavel Chlupacek
@pchlupacek
coll, glad to hear that :-)
yeah the Bodyencoder apply was changed to allow for materializers, essentially style found in cats :-)
objektwerks
@objektwerks
Using the fs2-http github site http server example, I'm unable to find the Strategy import that creates an implicit ConcurrentEffect and Time via Strategy.fromExecutor(ec). Even similar fs2-http code was of no help. Any ideas? Thanks in advance.
Luciano
@lJoublanc
@objektwerks what version are you on? Not sure if this is needed any longer in the latest release. These are my imports/implicits:
import cats.effect.{Effect, IO, IOApp, ExitCode}
import cats.syntax.functor._
import fs2.Stream
import fs2.Sink.showLinesStdOut
import spinoco.protocol.http.Uri

import scala.concurrent.ExecutionContext
import java.nio.channels.AsynchronousChannelGroup
import java.util.concurrent.Executors

object MyApp extends IOApp {

  implicit val ec : ExecutionContext = ExecutionContext.global
  implicit val ag : AsynchronousChannelGroup = AsynchronousChannelGroup.withThreadPool(ExecutionContext.fromExecutorService(Executors.newCachedThreadPool))
  implicit val ef : Effect[IO] = cats.effect.IO.ioConcurrentEffect
...
objektwerks
@objektwerks
@lJoublanc That helps. Thanks. Can you show the rest of your app. I'm having import issues with Content-Type and Content-Length. And, frankly, I'm beginning to wonder how dated the sample is on the github site. I'm on fs2 1.0.0 and fs2-http 0.4.0 Thanks.
Luciano
@lJoublanc
Hi, afraid it's proprietary so I can't show more - but let me know what you need. Also look higher up on this chat - there are a couple of comments on migrating to fs2 1.0.0 that you my find helpful.
objektwerks
@objektwerks
Okay, Luciano, thanks for your help. Cheers!
Soren
@srnb_gitlab

I'm trying to:

  • Make an http request
  • If the request succeeds (200):
    • Get the string body of said request
    • Parse that string into JSON using Circe
    • Turn that JSON into some A
  • If it is ratelimited (429):
    • Retry the request after the number of milliseconds specified by a response header
  • If it errors (???):
    • Return some error?

I'm having trouble constructing all of this into a program and understanding what my types should be for everything

Soren
@srnb_gitlab
I know how to:
  • Get an HTTP Response from a Request
  • Get the string body from the response
  • Turn the string body into JSON
  • Turn JSON into A
I can't figure out what I should do for error handling and ratelimiting though
Soren
@srnb_gitlab
How does fs2-http do error handling?
Soren
@srnb_gitlab
For websocketing, how do I allow pushing to the websocket client after it's been constructed and connected? For example if I'm calling a method and that method wants to send something over the socket?
Luciano
@lJoublanc

How does fs2-http do error handling?

@srnb_gitlab as it returns an fs2.Stream[F,_], it can capture the error in the effect F, which is typically a subtype of MonadError.
As you should be flatMaping over the response, you can simply return a Stream.raiseError(myerror) and this will handle resources safely.
Does that help?

Pavel Chlupacek
@pchlupacek
@srnb_gitlab sorry this somehow went under radar. I guess you are talking about the client. Un that case you just simply analyze the returned error code, and then you may decide to process body depending ob that code.
Soren
@srnb_gitlab
@lJoublanc Yeah, I think that helps.
I'm still wholly confused on the websocket stuff though
Luciano
@lJoublanc
Hmmm. Do you get how to 'post' on standard http?
i.e. that you need to use a flatMap for this too?
It should be similar for websocket, I suspect.
Soren
@srnb_gitlab
Websockets are just Pipe[F, Frame[String], Frame[String]] and the http client just makes a request using that pipe
I want client code to be able to call myClient.pushWSEvent(e) somehow and I'm not understanding how to work that into a Pipe
Luciano
@lJoublanc
Yeah, sorry. I just read that now. I haven't used this feature before.
Ok, that I think I can help with.
Soren
@srnb_gitlab
This is probably a basic fs2 thing I need to learn about, right?
Luciano
@lJoublanc
Yes, you can ask about that in the fs2 channel. It's a common pattern: create a stream out of a callback. That's what you're doing right?
Soren
@srnb_gitlab
Well ok so
I'm getting events in from the websocket
Luciano
@lJoublanc
In that case I suggest you look at the guide, linked from README.md. At the end there is examples of "how to talk to the external world"
Soren
@srnb_gitlab
I match those to some set of event handlers
Luciano
@lJoublanc
Ah ok... In that case, let me see ...
Soren
@srnb_gitlab
And the event handlers should be able to have an effect on what is sent through the WS
Luciano
@lJoublanc
Yeah, I think this is straightforward. Create a pipe like this:
in => in.evalMap( x => IO {mycallback(x) } )