by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 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
  • Jan 19 16:00
    jhnsmth commented #37
  • Dec 21 2019 15:46
    shankarshastri starred Spinoco/fs2-http
Anthony Cerruti
@srnb_gitlab
Well, I'm not getting errors
case class EventSocket[F[_]](myShard: Int, maxShards: Int, queue: Queue[F, Event])(implicit concurrent: Concurrent[F]) {

  def wsPipe(matcher: EventMatcher, handler: PartialFunction[Event, Option[Event]]): Pipe[F, Frame[String], Frame[String]] = { inbound =>
    val output = queue.dequeue.map(e => Frame.Text(e.asJson.noSpaces))
    output.concurrently(inbound.flatMap { in =>
      val json: Json = parse(in.a).right.toOption.get
      val matched: Stream[F, Option[Event]] = matcher[F](json)
      val handeled: Stream[F, Option[Event]] = matched.map(_.flatMap(handler))
      val queued: Stream[F, Unit] = handeled.flatMap(_.fold[Stream[F, Unit]](Stream.empty)(e => Stream.eval(queue.enqueue1(e))))
      queued
    })
  }

}
Am I doing this correctly?
Luciano
@lJoublanc
Just check the concurrently signature in the scaladoc; make sure it matches mergeDrainL i.e. the Nothing has to be on the correct side.
Anthony Cerruti
@srnb_gitlab
Any ADT to represent Websocket URIs?
Huh, URI can do wss but WebSocketRequest can't do URI
Anthony Cerruti
@srnb_gitlab
I just made my own match case for now
Media Type must be text, but is DefaultMediaType(application,json,true,true,WrappedArray(json))
How do I fix this? I'm using circe, should I just do bodyAs[Json] instead?
Anthony Cerruti
@srnb_gitlab
java.lang.Throwable: Failed to decode value: cannot acquire 16526844176 bits from a vector that contains 728 bits, content: ByteVector(95 bytes, 0x7b2274223a6e756c6c2c2273223a6e756c6c2c226f70223a31302c2264223a7b226865617274626561745f696e74657276616c223a34313235302c225f7472616365223a5b22676174657761792d7072642d6d61696e2d6b673677225d7d7d)
Why does fs2-http want 2GB
Anthony Cerruti
@srnb_gitlab
The first issue is an issue with normal requests, and the second is an issue with websockets, by the way
Anthony Cerruti
@srnb_gitlab
Should I make an issue on GitHub or is there something I need to fix on my end?
Pavel Chlupacek
@pchlupacek
@srnb_gitlab please feel free open issue. Even when this will be on your end, it us easier for us to respond, hence we will see you source code. I likely say that it is the case, hence both ws and http are used in production.
Anthony Cerruti
@srnb_gitlab
@pchlupacek #32 #33 #34
Pavel Chlupacek
@pchlupacek
@srnb_gitlab thanks, will reply you back. On the documentation/sample could do you have some free time to perhaps suggest P/R to fix that?
Anthony Cerruti
@srnb_gitlab
Yep, I can do that
#35
Anthony Cerruti
@srnb_gitlab
I need a plain text value option for the Authorization header
Adam Chlupacek
@AdamChlupacek
Hello @srnb_gitlab what do you mean plain text value? is the BasicHttpCredentials not enough?
Anthony Cerruti
@srnb_gitlab
@AdamChlupacek I didn't see a BasicHttpCredentials. I just recently had to move from DigestHttpCredentials to OAuthToken due to some sort of java error (But the only reason I can use OAuth token is because the token has a space in it)
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab yeah no problem
Anthony Cerruti
@srnb_gitlab
How do I tell a websocket to close with some sort of code?
I need to exit the application at some point.
Pavel Chlupacek
@pchlupacek
easiest way is to terminate stream that is piped to websocket. That will in turn close websocket
Anthony Cerruti
@srnb_gitlab
Is there a way to close with a code though? Not just terminate the connection?
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab Currently there is no way to do that, it should not be hard to extend the frames so that once of the frames in the websocket pipe will be close, and afterwards everything will clean up.
Anthony Cerruti
@srnb_gitlab
@AdamChlupacek BasicHttpCredentials is not enough
I need straight up plaintext
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab could you please provide how the header should look like? I am not entirely sure what you mean by plain text
Anthony Cerruti
@srnb_gitlab
s"Authorization: ${mpPlaintextCredentials.text}" @AdamChlupacek
case class PlaintextCredentials(text: String)
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab such format is sadly not RFC compliant according to https://tools.ietf.org/html/rfc7235#section-4.2, however you coud use our HttpCredentials.DigestHttpCredentials header in form of DigestHttpCredentials(mpPlaintextCredentials.text, Map.empty) this should be encoded into the form you require.
Anthony Cerruti
@srnb_gitlab
@AdamChlupacek Ah, but that gives an error that it's not an instance of OAuthCredentials
Adam Chlupacek
@AdamChlupacek
OAuthCredentials? That does not seem to be a concept in fs2-http? is that response that you get from the server where you are trying to connect?
@srnb_gitlab actually, what version of protocols are you using currently?
Anthony Cerruti
@srnb_gitlab
@AdamChlupacek What do you mean?
But that forces me to put Bot before the thing
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab well basically, fs2-http is dependent on spinoco/protocols where are all headers defined, it is possible that in your version of protocols the authorisation header does not yet support the multiple types of authorisation, thats why I was asking on what version of protocols are you. Anyhow in this encoding i think if you put your token instead od the bot, and left the field where you have the token now as empty string, it should be fine
Anthony Cerruti
@srnb_gitlab
@AdamChlupacek Nope. Then it throws an error about a trailing space.
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab thats weird, i am quite sure that we do not do these checks
I am also confused with the previous error as I could not find the “OAuthCredentials” error anywhere in the code
Anthony Cerruti
@srnb_gitlab
OAuthToken, not OAuthCredentials
It's in the same file as the other credentials
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab yeah, you seem to be using some outdated versions, could you please ensure that you are using "com.spinoco" %% "protocol-http" % "0.3.17" atleast, or "0.3.18-SNAPSHOT" for the newest one. Also please use the up to date fs2-http "0.4.1"
Anthony Cerruti
@srnb_gitlab
image.png
@AdamChlupacek
Should I require protocol-http explicitly?
Adam Chlupacek
@AdamChlupacek
@srnb_gitlab yes you should, protocols have different release cycle compared to fs2-http
Anthony Cerruti
@srnb_gitlab
Alright. I'll put in a reminder to do so.
Anthony Cerruti
@srnb_gitlab
image.png
@AdamChlupacek
val catsCoreVersion = "2.0.0-M1"
val catsEffectVersion = "2.0.0-M1"
val fs2CoreVersion = "1.0.4"
val fs2HttpVersion = "0.4.1"
val protocolHttpVersion = "0.3.17"
val circeVersion = "0.12.0-M1"
val circeFs2Version = "0.11.0"
val spireVersion = "0.16.1"

lazy val discocat = (project in file(".")).settings (
  organization := "org.discordscala",
  name := "discocat",
  version := "0.1.0",
  scalaVersion := "2.12.8",
  libraryDependencies ++= Seq(
    "org.typelevel" %% "cats-core" % catsCoreVersion,
    "org.typelevel" %% "cats-effect" % catsEffectVersion,
    "co.fs2" %% "fs2-core" % fs2CoreVersion,
    "com.spinoco" %% "fs2-http" % fs2HttpVersion,
    "com.spinoco" %% "protocol-http" % protocolHttpVersion,
    "io.circe" %% "circe-core" % circeVersion,
    "io.circe" %% "circe-generic" % circeVersion,
    "io.circe" %% "circe-generic-extras" % circeVersion,
    "io.circe" %% "circe-parser" % circeVersion,
    "io.circe" %% "circe-fs2" % circeFs2Version,
    "org.typelevel" %% "spire" % spireVersion,
  ),
  scalacOptions ++= Seq(
    "-unchecked",
    "-deprecation",
    "-feature",
    "-Ypartial-unification",
    "-language:higherKinds",
  ),
  addCompilerPlugin(
    "org.scalamacros" % "paradise" % "2.1.1" cross CrossVersion.full
  ),
)