object ServerSentEvent
- Companion:
- class
- Source:
- ServerSentEvent.scala
Type members
Classlikes
Inherited types
The names of the product elements
The names of the product elements
- Inherited from:
- Mirror
- Source:
- Mirror.scala
Value members
Concrete methods
LineBuffer.this._1
case_=>
thrownewIndexOutOfBoundsException(n.toString())
}
defappend(line:String):LineBuffer=LineBuffer.this.copy(lines=lines.:+[String](line))
defreify:Option[String]=if(lines.nonEmpty)Some.apply[String](lines.iterator.mkString("\n"))elseNone
}
objectLineBufferextendsAnyRefwithProduct{
overridedeftoString:String="LineBuffer"
def$lessinit$greater$default$1:Chain[String]@uncheckedVariance=Chain.empty[String]
typeMirroredMonoType
deffromProduct(`x$0₃`:Product):MirroredMonoType=newLineBuffer(`x$0₃`.productElement(0).$asInstanceOf$[Chain[String]])
}
valemptyBuffer:LineBuffer=LineBuffer.apply(LineBuffer.$lessinit$greater$default$1)
defgo(dataBuffer:LineBuffer,eventType:Option[String],id:Option[EventId],retry:Option[Long],commentBuffer:LineBuffer,stream:Stream[F,String]):Pull[F,ServerSentEvent,Unit]={
defdispatch(`stream₂`:Stream[F,String]):Pull[F,ServerSentEvent,Unit]={
valsse:ServerSentEvent=ServerSentEvent.apply(dataBuffer.reify,eventType,id,retry.map[FiniteDuration](((_$6:Long)=>FiniteDuration.apply(_$6,TimeUnit.MILLISECONDS))),commentBuffer.reify)
Pull.output1[Nothing,ServerSentEvent](sse).>>[F,ServerSentEvent,Unit](go(emptyBuffer,None,None,None,emptyBuffer,`stream₂`))
}
defhandleLine(field:String,value:String,`stream₃`:Stream[F,String]):Pull[F,ServerSentEvent,Unit]=fieldmatch{
case""=>
go(dataBuffer,eventType,id,retry,commentBuffer.append(value),`stream₃`)
case"event"=>
go(dataBuffer,Some.apply[String](value),id,retry,commentBuffer,`stream₃`)
case"data"=>
go(dataBuffer.append(value),eventType,id,retry,commentBuffer,`stream₃`)
case"id"=>
valnewId:EventId=EventId.apply(value)
go(dataBuffer,eventType,Some.apply[EventId](newId),retry,commentBuffer,`stream₃`)
case"retry"=>
valnewRetry:Option[Long]=Try.apply[Long](augmentString(value).toLong).toOption.orElse[Long](retry)
go(dataBuffer,eventType,id,newRetry,commentBuffer,`stream₃`)
case_=>
go(dataBuffer,eventType,id,retry,commentBuffer,`stream₃`)
}
InvariantOps[F,String](stream).pull.uncons1.flatMap[[x>:Nothing<:Any]=>F[x],ServerSentEvent,Unit](((x$1:Option[Tuple2[String,Stream[F,String]]])=>x$1match{
caseNone=>
Pull.done
caseSome(Tuple2("",stream))=>
dispatch(`stream₄`)
caseSome(Tuple2(s,stream))=>
FieldSeparator.split(s,2)match{
caseArray(field,value)=>
handleLine(`field₂`,`value₂`,`stream₅`)
caseArray(line)=>
handleLine(`line₂`,"",`stream₅`)
}
}))
}
((`stream₆`:Stream[F,Byte])=>StreamPullOps[F,ServerSentEvent](go(emptyBuffer,None,None,None,emptyBuffer,`stream₆`.through[F,String](utf8.decode[F].andThen[Stream[F,String]](text.lines[F])))).stream)
}" class="documentableAnchor">
def
LineBuffer.this._1
case_=>
thrownewIndexOutOfBoundsException(n.toString())
}
defappend(line:String):LineBuffer=LineBuffer.this.copy(lines=lines.:+[String](line))
defreify:Option[String]=if(lines.nonEmpty)Some.apply[String](lines.iterator.mkString("\n"))elseNone
}
objectLineBufferextendsAnyRefwithProduct{
overridedeftoString:String="LineBuffer"
def$lessinit$greater$default$1:Chain[String]@uncheckedVariance=Chain.empty[String]
typeMirroredMonoType
deffromProduct(`x$0₃`:Product):MirroredMonoType=newLineBuffer(`x$0₃`.productElement(0).$asInstanceOf$[Chain[String]])
}
valemptyBuffer:LineBuffer=LineBuffer.apply(LineBuffer.$lessinit$greater$default$1)
defgo(dataBuffer:LineBuffer,eventType:Option[String],id:Option[EventId],retry:Option[Long],commentBuffer:LineBuffer,stream:Stream[F,String]):Pull[F,ServerSentEvent,Unit]={
defdispatch(`stream₂`:Stream[F,String]):Pull[F,ServerSentEvent,Unit]={
valsse:ServerSentEvent=ServerSentEvent.apply(dataBuffer.reify,eventType,id,retry.map[FiniteDuration](((_$6:Long)=>FiniteDuration.apply(_$6,TimeUnit.MILLISECONDS))),commentBuffer.reify)
Pull.output1[Nothing,ServerSentEvent](sse).>>[F,ServerSentEvent,Unit](go(emptyBuffer,None,None,None,emptyBuffer,`stream₂`))
}
defhandleLine(field:String,value:String,`stream₃`:Stream[F,String]):Pull[F,ServerSentEvent,Unit]=fieldmatch{
case""=>
go(dataBuffer,eventType,id,retry,commentBuffer.append(value),`stream₃`)
case"event"=>
go(dataBuffer,Some.apply[String](value),id,retry,commentBuffer,`stream₃`)
case"data"=>
go(dataBuffer.append(value),eventType,id,retry,commentBuffer,`stream₃`)
case"id"=>
valnewId:EventId=EventId.apply(value)
go(dataBuffer,eventType,Some.apply[EventId](newId),retry,commentBuffer,`stream₃`)
case"retry"=>
valnewRetry:Option[Long]=Try.apply[Long](augmentString(value).toLong).toOption.orElse[Long](retry)
go(dataBuffer,eventType,id,newRetry,commentBuffer,`stream₃`)
case_=>
go(dataBuffer,eventType,id,retry,commentBuffer,`stream₃`)
}
InvariantOps[F,String](stream).pull.uncons1.flatMap[[x>:Nothing<:Any]=>F[x],ServerSentEvent,Unit](((x$1:Option[Tuple2[String,Stream[F,String]]])=>x$1match{
caseNone=>
Pull.done
caseSome(Tuple2("",stream))=>
dispatch(`stream₄`)
caseSome(Tuple2(s,stream))=>
FieldSeparator.split(s,2)match{
caseArray(field,value)=>
handleLine(`field₂`,`value₂`,`stream₅`)
caseArray(line)=>
handleLine(`line₂`,"",`stream₅`)
}
}))
}
((`stream₆`:Stream[F,Byte])=>StreamPullOps[F,ServerSentEvent](go(emptyBuffer,None,None,None,emptyBuffer,`stream₆`.through[F,String](utf8.decode[F].andThen[Stream[F,String]](text.lines[F])))).stream)
}" class="documentableName ">decoder[F[_]]: (F, Byte) => ServerSentEvent
- Source:
- ServerSentEvent.scala