These are chat archives for ReactiveX/RxJava

1st
Sep 2016
gruns
@gruns
Sep 01 2016 00:16
@Dorus: Thank you again for your time and help yesterday. Cheers.
Dorus
@Dorus
Sep 01 2016 00:19
@gruns You said that already. But thanks :) Did it work?
Yuriy Yarosh
@yuriy-yarosh
Sep 01 2016 16:41

Hi, Guys, yet another newbie question.
So I want to write a Http Server based on RxJS2, but I’m stuck with plain old Strings manipulation.

So, for instanse, I’ve got an Observable<String> which is being terminated with a ‘\r\n’ sequence.

I want to get from

‘123\r\n12’
‘3\r\n123\r\nab’
‘c\r\n\r\n

something like this

123’
‘123’
‘abc’
‘’

I think I should use a Subject to store some state but I don’t know really how it could be done.

Dorus
@Dorus
Sep 01 2016 16:55
@yuriy-yarosh you should just do source.flatMap(string -> Rx.Observable.from(string.split()))
Or well probably split('\r\n')
And similar you can also glue broken messages back together
Probably with scan i think
Yuriy Yarosh
@yuriy-yarosh
Sep 01 2016 16:57
It wouldn’t work that way because I have to buffer it somewhere.
Reactive-Extensions/RxJS#898 here’s the actual answer.
Dorus
@Dorus
Sep 01 2016 16:58
Wait are you using RxJs or RxJava?
Yuriy Yarosh
@yuriy-yarosh
Sep 01 2016 16:58
@Dorus does it even matter ?
Dorus
@Dorus
Sep 01 2016 16:59
Do i even need to answer that?
Yuriy Yarosh
@yuriy-yarosh
Sep 01 2016 16:59
@Dorus thanks, pal, I’ve figgured it out already.
Dorus
@Dorus
Sep 01 2016 16:59
Well for Rx the answer would be the same, but code samples would be slighlty different
OK np :)